public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-08-08 11:26 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2017-08-08 11:26 UTC (permalink / raw
  To: gentoo-commits

commit:     ed4d35101d3a9f71af037d4e0150a3d9bf2aa246
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  8 11:12:59 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Aug  8 11:26:34 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ed4d3510

sys-libs/glibc: disable ldconfig run in live ebuild

This makes glibc-9999 installable as-is at least on x86/amd64.

Package-Manager: Portage-2.3.6, Repoman-2.3.3

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 83fe7707c0f..b40109725f4 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,4 +18,4 @@ DIST glibc-2.24-patches-8.tar.bz2 71769 SHA256 0a21549ed196c5c03efc37273fb991e19
 DIST glibc-2.24.tar.xz 13554048 SHA256 99d4a3e8efd144d71488e478f62587578c0f4e1fa0b4eed47ee3d4975ebeb5d3 SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb WHIRLPOOL be82b47fc73f7e780e8e73a5f58b313d8e861d5ea8c4320f95ef0d8c1e125ff011d61dcfc0380be0e83868bd8c3299de1ea662da7fc8d709050e89b2c126e3eb
 DIST glibc-2.25-patches-5.tar.bz2 44356 SHA256 d9ea3908c8c4d561d22697d9830b4032cbbba46822613d5a3509d3b7e579c016 SHA512 ad3acf760e6cd714fe5d6833b53d8759e09c74ca60fbfd173e87dbb2d1062a5006427ca17db0b6ce695dae03e2ace7dc30992ae9b08e94ae4350b19ea03acdcc WHIRLPOOL 1fa660852f9e42fda956b4924351a532efdca88691cb2855c458e8bb9af1fc3cbdf2eb9c8ce93a7c57fa2d6a7e20b1c1a5c17d29b0d07f8e44e0ed8fdb7db8bc
 DIST glibc-2.25.tar.xz 13873900 SHA256 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e WHIRLPOOL dc2fafaa4a0e5581268338453838a03ed0c5e7a2af844e8fb7086ab8d3ae48efbdbe6f25db1d089ae669cd2f8b0412f690d965506753d86f8525da2df59b7953
-DIST glibc-9999-patches-1.tar.bz2 19159 SHA256 5c1f969f151a07ba9c52ee72d266b0e01f337632957e7a61ffa97082d4b2452a SHA512 9f52c215ae91028f1ec71bb948ae49ca7eac89a4c8b382352e1e5685978ce1e69824e71e10f22efbfb6cae3a8dea3b9c106f10b67b301e35b5b6d211b296c2d6 WHIRLPOOL 4bd2f1c3b0d2a537b3ab96f1dcca08ab7d133ebebb9b3b03b278abdc77aaf2a67b2c278760367c44e8299b631854ee3ffb81409b722137ec9e4978198be8d64b
+DIST glibc-9999-patches-2.tar.bz2 19716 SHA256 c146925e78244533fad6f0d65ec46201d688510847e217f4e6a57a8e9dba956a SHA512 f701add79924e44621d926d484bb8cbf1d02a7556e3c92ee7dc0dffa4b19d5036c8acbe342e705d4bd140d20375e697c595ec69f4ff01a40f5891f22ddc1948a WHIRLPOOL 23b794b53c274e7c384f267b2c808d330159f8f8354d438d69ebaa32a06b49f89504ca90927c3934179c7bc6ccba95fcac812be6bcf9b5c1092cb713d9b44517

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 5cf43b49525..22438818e12 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -27,7 +27,7 @@ esac
 RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER="4.7.3-r1"
 # patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="1"                                  # Gentoo patchset
+PATCH_VER="2"                                  # Gentoo patchset
 : ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
 
 IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-08-08 13:53 Matthias Maier
  0 siblings, 0 replies; 1076+ messages in thread
From: Matthias Maier @ 2017-08-08 13:53 UTC (permalink / raw
  To: gentoo-commits

commit:     ef373bd34db2e590eb96df1770599da86dfff5cf
Author:     Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  8 13:52:46 2017 +0000
Commit:     Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Tue Aug  8 13:52:46 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ef373bd3

sys-libs/glibc: 2:25-r2 restore keywords

Package-Manager: Portage-2.3.6, Repoman-2.3.3

 sys-libs/glibc/glibc-2.25-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r2.ebuild b/sys-libs/glibc/glibc-2.25-r2.ebuild
index 7b3a116ec69..61088f71f41 100644
--- a/sys-libs/glibc/glibc-2.25-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r2.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-08-12 16:59 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2017-08-12 16:59 UTC (permalink / raw
  To: gentoo-commits

commit:     280e225b50f7ab21e84d112087784c5424ba00be
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 12 16:57:33 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Aug 12 16:59:06 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=280e225b

sys-libs/glibc: update patchset, bug #627338, bug #592300

Two changes in the patchset:
- #627338: add 'files' fallback to nsswitch.conf entries
  as glibc-2.26 is deprecating 'compat' entries.
- #592300: make locale-get parallel by Tobias Klausmann

Bug: https://bugs.gentoo.org/627338
Bug: https://bugs.gentoo.org/592300
Package-Manager: Portage-2.3.6, Repoman-2.3.3

 sys-libs/glibc/Manifest                                 |  4 +++-
 .../glibc/{glibc-9999.ebuild => glibc-2.24-r4.ebuild}   | 17 ++++++++++++-----
 .../glibc/{glibc-9999.ebuild => glibc-2.25-r3.ebuild}   | 10 ++++++----
 sys-libs/glibc/glibc-9999.ebuild                        |  2 +-
 4 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index b40109725f4..36c8522f75e 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,7 +15,9 @@ DIST glibc-2.23-patches-7.tar.bz2 315221 SHA256 97ef9e370ce9b09d8e9b9f6239f7ef94
 DIST glibc-2.23-patches-8.tar.bz2 304199 SHA256 6110777176abfb8d287d82804d98e007c255db6040a1beca589a212772c90482 SHA512 470814bbbd9d4ee5fa2dd7570a2e14b0229723e373e801472856fd6c2f089499eddc300f69b49af8ba0edbdca583ee3ca521fdb5c642509717cafea0ad925fd2 WHIRLPOOL 1ef9a431d67d7669f34f7db21185d50ddd6dc82c549a9ff274f0b98454417f4098ee771bfe10073be12d3c153ee46ff36e40b46ecb31844ab09791ae29b49074
 DIST glibc-2.23.tar.xz 13455260 SHA256 94efeb00e4603c8546209cefb3e1a50a5315c86fa9b078b6fad758e187ce13e9 SHA512 b82953388cd028e174cb08f082557bbce0dad8b67b17d31b29f90102fd52a51e03d591448ecb64882a1c1d5303afffc7f6ede85cee4c784a9284fbc9b4ad26cf WHIRLPOOL 7c7e3bf55a89a04bac917b9ca5a1cbb1613f22c427d2766f114b5a36f9635856005b823852ef5d3b73462b577fe4e5865e68e7b64633d48a95fa1e5eaa831a71
 DIST glibc-2.24-patches-8.tar.bz2 71769 SHA256 0a21549ed196c5c03efc37273fb991e199c585140d954dca61140c3d0c227af9 SHA512 897c9d158f898edb355ee6478a7e0372a29e6c9d0b98cd80ccaa3ed4f0aab35e3b038217735f2a3b6007ff0cf27c7d6b27a84daaceca9361dce04bc5b2124ada WHIRLPOOL 222b375249c5a3e53fd0116fadf9612c5e5479cd845dc3fcebb496dfe38d70d0e2c84517b79258c73afe2c1f5d15ecec768d33659c10fb15ae59b9061072987d
+DIST glibc-2.24-patches-9.tar.bz2 72888 SHA256 7777196b584a282d8c64d6ba46e7729786cb3fc446c037421c03ae2dc79202dc SHA512 1e9efae34e8f1da264e54a1217ab015e94b1f4a99b5bc5a2a15d645c68383d0b97f80b7b45d9aa9e48dfc31f9ad474af3226f7dad66b25a457ca4df2df17cee9 WHIRLPOOL 954798ee80821b71ebff709ae6ef1714bdcf5b15b7bbb512ca587e86167b88c6a683636c8c1e7244a6e21f8257487a1393e4f3f4041f2461c6e387cf2796a465
 DIST glibc-2.24.tar.xz 13554048 SHA256 99d4a3e8efd144d71488e478f62587578c0f4e1fa0b4eed47ee3d4975ebeb5d3 SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb WHIRLPOOL be82b47fc73f7e780e8e73a5f58b313d8e861d5ea8c4320f95ef0d8c1e125ff011d61dcfc0380be0e83868bd8c3299de1ea662da7fc8d709050e89b2c126e3eb
 DIST glibc-2.25-patches-5.tar.bz2 44356 SHA256 d9ea3908c8c4d561d22697d9830b4032cbbba46822613d5a3509d3b7e579c016 SHA512 ad3acf760e6cd714fe5d6833b53d8759e09c74ca60fbfd173e87dbb2d1062a5006427ca17db0b6ce695dae03e2ace7dc30992ae9b08e94ae4350b19ea03acdcc WHIRLPOOL 1fa660852f9e42fda956b4924351a532efdca88691cb2855c458e8bb9af1fc3cbdf2eb9c8ce93a7c57fa2d6a7e20b1c1a5c17d29b0d07f8e44e0ed8fdb7db8bc
+DIST glibc-2.25-patches-6.tar.bz2 45450 SHA256 e0087cc67f48189a61370c4490ef2e7cee688cba41bd1881bec48b9c5107542a SHA512 434bcc1f38ee27bfc849d6ed4f3bfa6b59644951e02688f9ad865b534f1033f16f70134d16687341743c15b5f701405e0fb1133c245e56e5e4927771c786bd25 WHIRLPOOL f3f634a4a26cc283ed62feee0fe62fbc7b573a833e6920adc804874b8a69fcf6a1430e6f3c5a1ac5ea0ab4117e1cf061ff1c001ac041d99d0e3bee56c40cff77
 DIST glibc-2.25.tar.xz 13873900 SHA256 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e WHIRLPOOL dc2fafaa4a0e5581268338453838a03ed0c5e7a2af844e8fb7086ab8d3ae48efbdbe6f25db1d089ae669cd2f8b0412f690d965506753d86f8525da2df59b7953
-DIST glibc-9999-patches-2.tar.bz2 19716 SHA256 c146925e78244533fad6f0d65ec46201d688510847e217f4e6a57a8e9dba956a SHA512 f701add79924e44621d926d484bb8cbf1d02a7556e3c92ee7dc0dffa4b19d5036c8acbe342e705d4bd140d20375e697c595ec69f4ff01a40f5891f22ddc1948a WHIRLPOOL 23b794b53c274e7c384f267b2c808d330159f8f8354d438d69ebaa32a06b49f89504ca90927c3934179c7bc6ccba95fcac812be6bcf9b5c1092cb713d9b44517
+DIST glibc-9999-patches-3.tar.bz2 19892 SHA256 97f60ed6debd495610b123d7a27227e75942bea1a0fb1e5f78833a6f3bbe6c64 SHA512 75084b86a83d447d3a4b3959fa2a93d849e304ba9473ebec5570ca4fb5e2f8dfb38548faf3abc9fbd29b529f2c608b52eb2ef2e6e9a2ad5bea9a9298a19ef596 WHIRLPOOL 04a5c30aabf72530fa96fa3a8eadf8207d85d3a2a948ba5f4b72c0deeeae24e7eb71b99875f0e9b1018051fabb4a23630b41873fa4ff0d6ba9778ca6051212bf

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.24-r4.ebuild
similarity index 89%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.24-r4.ebuild
index 22438818e12..71ca5a1652c 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.24-r4.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 
@@ -22,12 +22,12 @@ case ${PV} in
 	inherit git-2
 	;;
 *)
+	RELEASE_VER=${PV}
 	;;
 esac
-RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER="4.7.3-r1"
 # patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="2"                                  # Gentoo patchset
+PATCH_VER="9"                                  # Gentoo patchset
 : ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
 
 IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
@@ -100,7 +100,7 @@ upstream_uris() {
 	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
 }
 gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~tamiko/distfiles/URI HTTP~dilfridge/distfiles/URI HTTP~slyfox/distfiles/URI"
+	local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
 	devspace=${devspace//HTTP/https://dev.gentoo.org/}
 	echo mirror://gentoo/$1 ${devspace//URI/$1}
 }
@@ -121,13 +121,15 @@ src_prepare() {
 
 	cd "${S}"
 
+	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
+
 	if use hardened ; then
 		# We don't enable these for non-hardened as the output is very terse --
 		# it only states that a crash happened.  The default upstream behavior
 		# includes backtraces and symbols.
 		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
 		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
+		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-chk_fail.c debug/chk_fail.c || die
 
 		if use debug ; then
 			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
@@ -136,6 +138,11 @@ src_prepare() {
 				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
 				debug/Makefile || die
 		fi
+
+		# Build various bits with ssp-all
+		sed -i \
+			-e 's:-fstack-protector$:-fstack-protector-all:' \
+			*/Makefile || die
 	fi
 
 	case $(gcc-fullversion) in

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.25-r3.ebuild
similarity index 92%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.25-r3.ebuild
index 22438818e12..dc2fbd57eeb 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r3.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 
@@ -22,12 +22,12 @@ case ${PV} in
 	inherit git-2
 	;;
 *)
+	RELEASE_VER=${PV}
 	;;
 esac
-RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER="4.7.3-r1"
 # patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="2"                                  # Gentoo patchset
+PATCH_VER="6"                                  # Gentoo patchset
 : ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
 
 IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
@@ -100,7 +100,7 @@ upstream_uris() {
 	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
 }
 gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~tamiko/distfiles/URI HTTP~dilfridge/distfiles/URI HTTP~slyfox/distfiles/URI"
+	local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
 	devspace=${devspace//HTTP/https://dev.gentoo.org/}
 	echo mirror://gentoo/$1 ${devspace//URI/$1}
 }
@@ -121,6 +121,8 @@ src_prepare() {
 
 	cd "${S}"
 
+	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
+
 	if use hardened ; then
 		# We don't enable these for non-hardened as the output is very terse --
 		# it only states that a crash happened.  The default upstream behavior

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 22438818e12..d6755ad94b2 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -27,7 +27,7 @@ esac
 RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER="4.7.3-r1"
 # patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="2"                                  # Gentoo patchset
+PATCH_VER="3"                                  # Gentoo patchset
 : ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
 
 IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-08-13 16:08 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2017-08-13 16:08 UTC (permalink / raw
  To: gentoo-commits

commit:     925bb6a2ce996cdf1c92ed97918a74efd74ffb8d
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 13 16:08:39 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Aug 13 16:08:50 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=925bb6a2

sys-libs/glibc: cut new glibc patchset, bug #627164

This patchset has single new patch which fixes
build failure against binutils-2.29.

Bug: https://sourceware.org/PR21666
Bug: https://bugs.gentoo.org/627164
Package-Manager: Portage-2.3.6, Repoman-2.3.3

 sys-libs/glibc/Manifest             | 4 ++--
 sys-libs/glibc/glibc-2.24-r4.ebuild | 2 +-
 sys-libs/glibc/glibc-2.25-r3.ebuild | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 36c8522f75e..1373cb56892 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,10 +14,10 @@ DIST glibc-2.22.tar.xz 12969072 SHA256 eb731406903befef1d8f878a46be75ef862b9056a
 DIST glibc-2.23-patches-7.tar.bz2 315221 SHA256 97ef9e370ce9b09d8e9b9f6239f7ef94dd837d29b7bfc1404438c63da1d534ac SHA512 c0d0cab0a370acef0b085b0ab09ce868425a12bbb371d0a9ff91dc83a74a0d8d3b541d10c44650b00b7cb155f8ac1f87764e6a6bd9d6bae8a9a904b4df1650ef WHIRLPOOL 128ea1a2eeaad3d95cdf1054d10232a34e8f88d10ed8907a67d9ff02734243d20b21595ca3698a4861d9c65e2a59aedbcf8e399bd1ed879dba1556ce2995ad9b
 DIST glibc-2.23-patches-8.tar.bz2 304199 SHA256 6110777176abfb8d287d82804d98e007c255db6040a1beca589a212772c90482 SHA512 470814bbbd9d4ee5fa2dd7570a2e14b0229723e373e801472856fd6c2f089499eddc300f69b49af8ba0edbdca583ee3ca521fdb5c642509717cafea0ad925fd2 WHIRLPOOL 1ef9a431d67d7669f34f7db21185d50ddd6dc82c549a9ff274f0b98454417f4098ee771bfe10073be12d3c153ee46ff36e40b46ecb31844ab09791ae29b49074
 DIST glibc-2.23.tar.xz 13455260 SHA256 94efeb00e4603c8546209cefb3e1a50a5315c86fa9b078b6fad758e187ce13e9 SHA512 b82953388cd028e174cb08f082557bbce0dad8b67b17d31b29f90102fd52a51e03d591448ecb64882a1c1d5303afffc7f6ede85cee4c784a9284fbc9b4ad26cf WHIRLPOOL 7c7e3bf55a89a04bac917b9ca5a1cbb1613f22c427d2766f114b5a36f9635856005b823852ef5d3b73462b577fe4e5865e68e7b64633d48a95fa1e5eaa831a71
+DIST glibc-2.24-patches-10.tar.bz2 73586 SHA256 d479033b63ff796fea56fb1bde390c442021acd856994b15c983b4a89e46fbbe SHA512 fc9191a85da53a2515bbaab228648936682e04267284049468e0c82284f618ab2907b9247baca701e16edc50640199ff6d8e2a6a93ccbd5a9d3b0eb73cc484ca WHIRLPOOL 7afe94307900a70de2f5e028d8ec9e0f4b06b661ec6493217e51a13d750f891e10b45c0f66d86fa83c16cc3ce539bb257039b33bc3e363469cd03502d956d75e
 DIST glibc-2.24-patches-8.tar.bz2 71769 SHA256 0a21549ed196c5c03efc37273fb991e199c585140d954dca61140c3d0c227af9 SHA512 897c9d158f898edb355ee6478a7e0372a29e6c9d0b98cd80ccaa3ed4f0aab35e3b038217735f2a3b6007ff0cf27c7d6b27a84daaceca9361dce04bc5b2124ada WHIRLPOOL 222b375249c5a3e53fd0116fadf9612c5e5479cd845dc3fcebb496dfe38d70d0e2c84517b79258c73afe2c1f5d15ecec768d33659c10fb15ae59b9061072987d
-DIST glibc-2.24-patches-9.tar.bz2 72888 SHA256 7777196b584a282d8c64d6ba46e7729786cb3fc446c037421c03ae2dc79202dc SHA512 1e9efae34e8f1da264e54a1217ab015e94b1f4a99b5bc5a2a15d645c68383d0b97f80b7b45d9aa9e48dfc31f9ad474af3226f7dad66b25a457ca4df2df17cee9 WHIRLPOOL 954798ee80821b71ebff709ae6ef1714bdcf5b15b7bbb512ca587e86167b88c6a683636c8c1e7244a6e21f8257487a1393e4f3f4041f2461c6e387cf2796a465
 DIST glibc-2.24.tar.xz 13554048 SHA256 99d4a3e8efd144d71488e478f62587578c0f4e1fa0b4eed47ee3d4975ebeb5d3 SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb WHIRLPOOL be82b47fc73f7e780e8e73a5f58b313d8e861d5ea8c4320f95ef0d8c1e125ff011d61dcfc0380be0e83868bd8c3299de1ea662da7fc8d709050e89b2c126e3eb
 DIST glibc-2.25-patches-5.tar.bz2 44356 SHA256 d9ea3908c8c4d561d22697d9830b4032cbbba46822613d5a3509d3b7e579c016 SHA512 ad3acf760e6cd714fe5d6833b53d8759e09c74ca60fbfd173e87dbb2d1062a5006427ca17db0b6ce695dae03e2ace7dc30992ae9b08e94ae4350b19ea03acdcc WHIRLPOOL 1fa660852f9e42fda956b4924351a532efdca88691cb2855c458e8bb9af1fc3cbdf2eb9c8ce93a7c57fa2d6a7e20b1c1a5c17d29b0d07f8e44e0ed8fdb7db8bc
-DIST glibc-2.25-patches-6.tar.bz2 45450 SHA256 e0087cc67f48189a61370c4490ef2e7cee688cba41bd1881bec48b9c5107542a SHA512 434bcc1f38ee27bfc849d6ed4f3bfa6b59644951e02688f9ad865b534f1033f16f70134d16687341743c15b5f701405e0fb1133c245e56e5e4927771c786bd25 WHIRLPOOL f3f634a4a26cc283ed62feee0fe62fbc7b573a833e6920adc804874b8a69fcf6a1430e6f3c5a1ac5ea0ab4117e1cf061ff1c001ac041d99d0e3bee56c40cff77
+DIST glibc-2.25-patches-7.tar.bz2 46222 SHA256 af1a3c13409599486d58c531d04d794698b1ac04cc883dbdb0d29af7b44d7ca5 SHA512 21637f3b1a20cef55ce52311bc7b4d60d93b6f04a8d45944ccb9286fc330e262c6f37f729b7f5a5daec588821e8ae330f89cb7f7e84463b4e533aa80f408e415 WHIRLPOOL bc48fa53ddd264559378e8075c42bd38fd49015ac76834aaed7e0ec338dbbba1f4fdc1d2aaea6d53d72bbbaef99920cad489188b95cd0ec06b02ce5def110c11
 DIST glibc-2.25.tar.xz 13873900 SHA256 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e WHIRLPOOL dc2fafaa4a0e5581268338453838a03ed0c5e7a2af844e8fb7086ab8d3ae48efbdbe6f25db1d089ae669cd2f8b0412f690d965506753d86f8525da2df59b7953
 DIST glibc-9999-patches-3.tar.bz2 19892 SHA256 97f60ed6debd495610b123d7a27227e75942bea1a0fb1e5f78833a6f3bbe6c64 SHA512 75084b86a83d447d3a4b3959fa2a93d849e304ba9473ebec5570ca4fb5e2f8dfb38548faf3abc9fbd29b529f2c608b52eb2ef2e6e9a2ad5bea9a9298a19ef596 WHIRLPOOL 04a5c30aabf72530fa96fa3a8eadf8207d85d3a2a948ba5f4b72c0deeeae24e7eb71b99875f0e9b1018051fabb4a23630b41873fa4ff0d6ba9778ca6051212bf

diff --git a/sys-libs/glibc/glibc-2.24-r4.ebuild b/sys-libs/glibc/glibc-2.24-r4.ebuild
index 71ca5a1652c..29a17f827ae 100644
--- a/sys-libs/glibc/glibc-2.24-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.24-r4.ebuild
@@ -27,7 +27,7 @@ case ${PV} in
 esac
 GCC_BOOTSTRAP_VER="4.7.3-r1"
 # patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="9"                                  # Gentoo patchset
+PATCH_VER="10"                                 # Gentoo patchset
 : ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
 
 IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"

diff --git a/sys-libs/glibc/glibc-2.25-r3.ebuild b/sys-libs/glibc/glibc-2.25-r3.ebuild
index dc2fbd57eeb..3174a4d3611 100644
--- a/sys-libs/glibc/glibc-2.25-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r3.ebuild
@@ -27,7 +27,7 @@ case ${PV} in
 esac
 GCC_BOOTSTRAP_VER="4.7.3-r1"
 # patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="6"                                  # Gentoo patchset
+PATCH_VER="7"                                  # Gentoo patchset
 : ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
 
 IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-08-17 21:13 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2017-08-17 21:13 UTC (permalink / raw
  To: gentoo-commits

commit:     457d3ddf64abb388ad418793d5b0a9f5dfd80ee8
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 17 21:11:12 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Aug 17 21:13:19 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=457d3ddf

sys-libs/glibc: backport memchr() out-of-bounds fix to 2.25, bug #628100

Backport of upstream patch:
https://sourceware.org/git/?p=glibc.git;a=commit;h=ccb4fd7a657b0fbc4890c98f4586d58a135fc583

Reported-by: Aidan Thornton
Bug: https://bugs.gentoo.org/628100
Package-Manager: Portage-2.3.7, Repoman-2.3.3

 sys-libs/glibc/Manifest             |   1 +
 sys-libs/glibc/glibc-2.25-r4.ebuild | 150 ++++++++++++++++++++++++++++++++++++
 2 files changed, 151 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 1373cb56892..9a8836e4142 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,5 +19,6 @@ DIST glibc-2.24-patches-8.tar.bz2 71769 SHA256 0a21549ed196c5c03efc37273fb991e19
 DIST glibc-2.24.tar.xz 13554048 SHA256 99d4a3e8efd144d71488e478f62587578c0f4e1fa0b4eed47ee3d4975ebeb5d3 SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb WHIRLPOOL be82b47fc73f7e780e8e73a5f58b313d8e861d5ea8c4320f95ef0d8c1e125ff011d61dcfc0380be0e83868bd8c3299de1ea662da7fc8d709050e89b2c126e3eb
 DIST glibc-2.25-patches-5.tar.bz2 44356 SHA256 d9ea3908c8c4d561d22697d9830b4032cbbba46822613d5a3509d3b7e579c016 SHA512 ad3acf760e6cd714fe5d6833b53d8759e09c74ca60fbfd173e87dbb2d1062a5006427ca17db0b6ce695dae03e2ace7dc30992ae9b08e94ae4350b19ea03acdcc WHIRLPOOL 1fa660852f9e42fda956b4924351a532efdca88691cb2855c458e8bb9af1fc3cbdf2eb9c8ce93a7c57fa2d6a7e20b1c1a5c17d29b0d07f8e44e0ed8fdb7db8bc
 DIST glibc-2.25-patches-7.tar.bz2 46222 SHA256 af1a3c13409599486d58c531d04d794698b1ac04cc883dbdb0d29af7b44d7ca5 SHA512 21637f3b1a20cef55ce52311bc7b4d60d93b6f04a8d45944ccb9286fc330e262c6f37f729b7f5a5daec588821e8ae330f89cb7f7e84463b4e533aa80f408e415 WHIRLPOOL bc48fa53ddd264559378e8075c42bd38fd49015ac76834aaed7e0ec338dbbba1f4fdc1d2aaea6d53d72bbbaef99920cad489188b95cd0ec06b02ce5def110c11
+DIST glibc-2.25-patches-8.tar.bz2 47110 SHA256 1dc41664153369886d240a1851b15bf0c3c3739c8319e6d68cb0c2f85fc98901 SHA512 41d772c47770a63502c863f3c9bb05164e0ceab69fb7b7f355c25685ae4285d73e9ab0e3836162bd11852339055329d0bdc7238f3191fde39a50ce0d9a60454c WHIRLPOOL c6e0443d75e2e4607226caa4df1ce2b10ef21ec2564b447e2a287888d1f593d51f334a6e1ab942f5d1602d02c6fee87ce4ef9a7db3409de6063bc377a470a42d
 DIST glibc-2.25.tar.xz 13873900 SHA256 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e WHIRLPOOL dc2fafaa4a0e5581268338453838a03ed0c5e7a2af844e8fb7086ab8d3ae48efbdbe6f25db1d089ae669cd2f8b0412f690d965506753d86f8525da2df59b7953
 DIST glibc-9999-patches-3.tar.bz2 19892 SHA256 97f60ed6debd495610b123d7a27227e75942bea1a0fb1e5f78833a6f3bbe6c64 SHA512 75084b86a83d447d3a4b3959fa2a93d849e304ba9473ebec5570ca4fb5e2f8dfb38548faf3abc9fbd29b529f2c608b52eb2ef2e6e9a2ad5bea9a9298a19ef596 WHIRLPOOL 04a5c30aabf72530fa96fa3a8eadf8207d85d3a2a948ba5f4b72c0deeeae24e7eb71b99875f0e9b1018051fabb4a23630b41873fa4ff0d6ba9778ca6051212bf

diff --git a/sys-libs/glibc/glibc-2.25-r4.ebuild b/sys-libs/glibc/glibc-2.25-r4.ebuild
new file mode 100644
index 00000000000..27cd42605ff
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.25-r4.ebuild
@@ -0,0 +1,150 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit toolchain-glibc
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+case ${PV} in
+9999*)
+	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+	EGIT_SOURCEDIRS="${S}"
+	inherit git-2
+	;;
+*)
+	RELEASE_VER=${PV}
+	;;
+esac
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
+PATCH_VER="8"                                  # Gentoo patchset
+: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
+
+IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2"
+RDEPEND="${COMMON_DEPEND}
+	!sys-kernel/ps3-sources
+	sys-apps/gentoo-functions
+	!sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !crosscompile_opts_headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.7
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.7
+		virtual/os-headers"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+	local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
+	devspace=${devspace//HTTP/https://dev.gentoo.org/}
+	echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+src_unpack() {
+	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+
+	toolchain-glibc_src_unpack
+}
+
+src_prepare() {
+	toolchain-glibc_src_prepare
+
+	cd "${S}"
+
+	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
+
+	if use hardened ; then
+		# We don't enable these for non-hardened as the output is very terse --
+		# it only states that a crash happened.  The default upstream behavior
+		# includes backtraces and symbols.
+		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
+
+		if use debug ; then
+			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+			sed -i \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				debug/Makefile || die
+		fi
+	fi
+
+	case $(gcc-fullversion) in
+	4.8.[0-3]|4.9.0)
+		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
+		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
+		die "need to switch compilers #547420"
+		;;
+	esac
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-08-23 16:10 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-08-23 16:10 UTC (permalink / raw
  To: gentoo-commits

commit:     df22cd503e495ec1b029cfd401306fd028481752
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 23 16:10:21 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Aug 23 16:10:44 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=df22cd50

sys-libs/glibc: Version bump. Only build-tested, no keywords.

Tests fail (surprise)

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/Manifest                              |  2 ++
 .../glibc/{glibc-9999.ebuild => glibc-2.26.ebuild}   | 20 ++++++++++----------
 sys-libs/glibc/glibc-9999.ebuild                     | 18 +++++++++---------
 3 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 9a8836e4142..082bd06d9a6 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -21,4 +21,6 @@ DIST glibc-2.25-patches-5.tar.bz2 44356 SHA256 d9ea3908c8c4d561d22697d9830b4032c
 DIST glibc-2.25-patches-7.tar.bz2 46222 SHA256 af1a3c13409599486d58c531d04d794698b1ac04cc883dbdb0d29af7b44d7ca5 SHA512 21637f3b1a20cef55ce52311bc7b4d60d93b6f04a8d45944ccb9286fc330e262c6f37f729b7f5a5daec588821e8ae330f89cb7f7e84463b4e533aa80f408e415 WHIRLPOOL bc48fa53ddd264559378e8075c42bd38fd49015ac76834aaed7e0ec338dbbba1f4fdc1d2aaea6d53d72bbbaef99920cad489188b95cd0ec06b02ce5def110c11
 DIST glibc-2.25-patches-8.tar.bz2 47110 SHA256 1dc41664153369886d240a1851b15bf0c3c3739c8319e6d68cb0c2f85fc98901 SHA512 41d772c47770a63502c863f3c9bb05164e0ceab69fb7b7f355c25685ae4285d73e9ab0e3836162bd11852339055329d0bdc7238f3191fde39a50ce0d9a60454c WHIRLPOOL c6e0443d75e2e4607226caa4df1ce2b10ef21ec2564b447e2a287888d1f593d51f334a6e1ab942f5d1602d02c6fee87ce4ef9a7db3409de6063bc377a470a42d
 DIST glibc-2.25.tar.xz 13873900 SHA256 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e WHIRLPOOL dc2fafaa4a0e5581268338453838a03ed0c5e7a2af844e8fb7086ab8d3ae48efbdbe6f25db1d089ae669cd2f8b0412f690d965506753d86f8525da2df59b7953
+DIST glibc-2.26-patches-0.tar.bz2 22289 SHA256 4b59db44f22c415a3c30a543927e69c04d15ef5d9d5f2ce63eba30e0354ebbd1 SHA512 4afb828d2897c68c7a16e42a2c38a872d38c42954a626d0650cc3fface907d28ba4f5b50504aa4e6c465c5b9c37ab0014d2d228b29ac50335aeb85fec713fd78 WHIRLPOOL 6fa2ad2be084e14e4e9105947232a6b5057d23dd0b55b40bd15bb48c84bfb492a22a27d8a3358f6cc1335b7c9652a0be2d7a977eb266dd08d531ecee12449184
+DIST glibc-2.26.tar.xz 14682748 SHA256 e54e0a934cd2bc94429be79da5e9385898d2306b9eaf3c92d5a77af96190f6bd SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0 WHIRLPOOL 9091c3bccc9b590de6b9595aa391ba01091f0c301bd9199d7c48fbeaeeb013ec9c683c68b65b59c5a69e3905b7f842cca1b0a410431967ecb3a1229b8535486f
 DIST glibc-9999-patches-3.tar.bz2 19892 SHA256 97f60ed6debd495610b123d7a27227e75942bea1a0fb1e5f78833a6f3bbe6c64 SHA512 75084b86a83d447d3a4b3959fa2a93d849e304ba9473ebec5570ca4fb5e2f8dfb38548faf3abc9fbd29b529f2c608b52eb2ef2e6e9a2ad5bea9a9298a19ef596 WHIRLPOOL 04a5c30aabf72530fa96fa3a8eadf8207d85d3a2a948ba5f4b72c0deeeae24e7eb71b99875f0e9b1018051fabb4a23630b41873fa4ff0d6ba9778ca6051212bf

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.26.ebuild
similarity index 95%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.26.ebuild
index d6755ad94b2..f60657d38dc 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.26.ebuild
@@ -1,7 +1,7 @@
 # Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI="5"
+EAPI=5
 
 inherit toolchain-glibc
 
@@ -9,25 +9,25 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 
 # Configuration variables
-RELEASE_VER=""
-case ${PV} in
-9999*)
+
+if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
 	EGIT_SOURCEDIRS="${S}"
 	inherit git-2
-	;;
-*)
-	;;
-esac
+else
+	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS=""
+fi
+
 RELEASE_VER=${PV}
+
 GCC_BOOTSTRAP_VER="4.7.3-r1"
 # patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="3"                                  # Gentoo patchset
+PATCH_VER="0"                                  # Gentoo patchset
 : ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
 
 IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index d6755ad94b2..3cea38a2924 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1,7 +1,7 @@
 # Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI="5"
+EAPI=5
 
 inherit toolchain-glibc
 
@@ -9,22 +9,22 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 
 # Configuration variables
-RELEASE_VER=""
-case ${PV} in
-9999*)
+
+if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
 	EGIT_SOURCEDIRS="${S}"
 	inherit git-2
-	;;
-*)
-	;;
-esac
+else
+	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS=""
+fi
+
 RELEASE_VER=${PV}
+
 GCC_BOOTSTRAP_VER="4.7.3-r1"
 # patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
 PATCH_VER="3"                                  # Gentoo patchset


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-02 18:29 Alexis Ballier
  0 siblings, 0 replies; 1076+ messages in thread
From: Alexis Ballier @ 2017-09-02 18:29 UTC (permalink / raw
  To: gentoo-commits

commit:     48bf70f2dc72ddd2be72cda3aa0acffdfdc45470
Author:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  2 18:29:29 2017 +0000
Commit:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
CommitDate: Sat Sep  2 18:29:29 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=48bf70f2

sys-libs/glibc: arm64 stable, bug #622220

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/glibc-2.23-r4.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.23-r4.ebuild b/sys-libs/glibc/glibc-2.23-r4.ebuild
index b3bd1c46df7..01efec5a7b4 100644
--- a/sys-libs/glibc/glibc-2.23-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.23-r4.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-09 21:23 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-09 21:23 UTC (permalink / raw
  To: gentoo-commits

commit:     94888b758915aa8b936fd0461ebb684e024c25f1
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  3 20:06:27 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Sep  9 21:21:26 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=94888b75

sys-libs/glibc: Integrate eclass code of phase functions

 sys-libs/glibc/glibc-2.26-r1.ebuild | 904 ++++++++++++++++++++++++++++++++++++
 1 file changed, 904 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.26-r1.ebuild b/sys-libs/glibc/glibc-2.26-r1.ebuild
new file mode 100644
index 00000000000..98b89a06c6f
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.26-r1.ebuild
@@ -0,0 +1,904 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit toolchain-glibc
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+	EGIT_SOURCEDIRS="${S}"
+	inherit git-2
+else
+	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS=""
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
+PATCH_VER="0"                                  # Gentoo patchset
+: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
+
+IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2"
+RDEPEND="${COMMON_DEPEND}
+	!sys-kernel/ps3-sources
+	sys-apps/gentoo-functions
+	!sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !crosscompile_opts_headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.7
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.7
+		virtual/os-headers"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+	local devspace="HTTP~vapier/dist/URI HTTP~tamiko/distfiles/URI HTTP~dilfridge/distfiles/URI HTTP~slyfox/distfiles/URI"
+	devspace=${devspace//HTTP/https://dev.gentoo.org/}
+	echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+#
+# the phases
+#
+
+pkg_pretend() {
+    check_devpts
+
+	# Prevent native builds from downgrading.
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ ${ROOT} == "/" ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+		# The high rev # is to allow people to downgrade between -r# versions.
+		# We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine.
+		# Hopefully we never actually use a r# this high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction"
+			die "aborting to save your system"
+		fi
+
+		if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
+		then
+			eerror "Your patched vendor kernel is broken.  You need to get an"
+			eerror "update from whoever is providing the kernel to you."
+			eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227"
+			eerror "http://bugs.gentoo.org/262698"
+			die "keeping your system alive, say thank you"
+		fi
+
+		if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
+		then
+			eerror "Your old kernel is broken.  You need to update it to"
+			eerror "a newer version as syscall(<bignum>) will break."
+			eerror "http://bugs.gentoo.org/279260"
+			die "keeping your system alive, say thank you"
+		fi
+	fi
+
+	# users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read http://www.gentoo.org/doc/en/change-chost.xml"
+		die "please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	use hardened && ! tc-enables-pie && \
+		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
+
+	# Make sure host system is up to date #394453
+	if has_version '<sys-libs/glibc-2.13' && \
+	   [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]]
+	then
+		ebegin "Scanning system for __guard to see if you need to rebuild first ..."
+		local files=$(
+			scanelf -qys__guard -F'#s%F' \
+				"${EROOT}"/*bin/ \
+				"${EROOT}"/lib* \
+				"${EROOT}"/usr/*bin/ \
+				"${EROOT}"/usr/lib* | \
+				egrep -v \
+					-e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \
+					-e "^${EROOT}/sbin/(ldconfig|sln)$"
+		)
+		[[ -z ${files} ]]
+		if ! eend $? ; then
+			eerror "Your system still has old SSP __guard symbols.  You need to"
+			eerror "rebuild all the packages that provide these files first:"
+			eerror "${files}"
+			die "old __guard detected"
+		fi
+	fi
+}
+
+src_unpack() {
+	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+
+	setup_env
+
+	# Check NPTL support _before_ we unpack things to save some time
+	want_nptl && check_nptl_support
+
+	if [[ -n ${EGIT_REPO_URIS} ]] ; then
+		local i d
+		for ((i=0; i<${#EGIT_REPO_URIS[@]}; ++i)) ; do
+			EGIT_REPO_URI=${EGIT_REPO_URIS[$i]}
+			EGIT_SOURCEDIR=${EGIT_SOURCEDIRS[$i]}
+			git-2_src_unpack
+		done
+	else
+		unpack_pkg
+	fi
+
+	cd "${S}"
+	touch locale/C-translit.h #185476 #218003
+	[[ -n ${LT_VER}     ]] && unpack_pkg linuxthreads ${LT_VER}
+	[[ -n ${PORTS_VER}  ]] && unpack_pkg ports ${PORTS_VER}
+	[[ -n ${LIBIDN_VER} ]] && unpack_pkg libidn
+
+	if [[ -n ${PATCH_VER} ]] ; then
+		cd "${WORKDIR}"
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
+		# pull out all the addons
+		local d
+		for d in extra/*/configure ; do
+			d=${d%/configure}
+			[[ -d ${S}/${d} ]] && die "${d} already exists in \${S}"
+			mv "${d}" "${S}" || die "moving ${d} failed"
+		done
+	fi
+}
+
+src_prepare() {
+	# XXX: We should do the branchupdate, before extracting the manpages and
+	# infopages else it does not help much (mtimes change if there is a change
+	# to them with branchupdate)
+	if [[ -n ${BRANCH_UPDATE} ]] ; then
+		epatch "${DISTDIR}"/glibc-${RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
+
+		# Snapshot date patch
+		einfo "Patching version to display snapshot date ..."
+		sed -i -e "s:\(#define RELEASE\).*:\1 \"${BRANCH_UPDATE}\":" version.h
+	fi
+
+	if [[ -n ${PATCH_VER} ]] && ! use vanilla ; then
+		EPATCH_MULTI_MSG="Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER} ..." \
+		EPATCH_EXCLUDE=${GLIBC_PATCH_EXCLUDE} \
+		EPATCH_SUFFIX="patch" \
+		ARCH=$(tc-arch) \
+		epatch "${WORKDIR}"/patches
+	fi
+
+	if just_headers ; then
+		if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
+			# mips peeps like to screw with us.  if building headers,
+			# we don't have a real compiler, so we can't let them
+			# insert -mabi on us.
+			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
+			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
+		fi
+	fi
+
+	eapply_user
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -type f '(' -size 0 -o -name "*.orig" ')' -delete
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+
+	if use hardened ; then
+		# We don't enable these for non-hardened as the output is very terse --
+		# it only states that a crash happened.  The default upstream behavior
+		# includes backtraces and symbols.
+		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
+
+		if use debug ; then
+			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+			sed -i \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				debug/Makefile || die
+		fi
+	fi
+
+	case $(gcc-fullversion) in
+	4.8.[0-3]|4.9.0)
+		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
+		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
+		die "need to switch compilers #547420"
+		;;
+	esac
+}
+
+glibc_do_configure() {
+	# Glibc does not work with gold (for various reasons) #269274.
+	tc-ld-disable-gold
+
+	dump_toolchain_settings "Configuring glibc for $1"
+
+	local myconf=()
+
+	# set addons
+	pushd "${S}" > /dev/null
+	local addons=$(echo */configure | sed \
+		-e 's:/configure::g' \
+		-e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
+		-e 's: \+$::' \
+		-e 's! !,!g' \
+		-e 's!^!,!' \
+		-e '/^,\*$/d')
+	[[ -d ports ]] && addons+=",ports"
+	popd > /dev/null
+
+	if has_version '<sys-libs/glibc-2.13' ; then
+		myconf+=( --enable-old-ssp-compat )
+	fi
+
+	if version_is_at_least 2.25 ; then
+		myconf+=( --enable-stack-protector=all )
+	fi
+
+	if version_is_at_least 2.25 ; then
+		myconf+=( --enable-stackguard-randomization )
+	else
+		myconf+=( $(use_enable hardened stackguard-randomization) )
+	fi
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	if [[ $1 == "linuxthreads" ]] ; then
+		if want_tls ; then
+			myconf+=( --with-tls )
+
+			if ! want__thread || use glibc-compat20 || [[ ${LT_KER_VER} == 2.[02].* ]] ; then
+				myconf+=( --without-__thread )
+			else
+				myconf+=( --with-__thread )
+			fi
+		else
+			myconf+=( --without-tls --without-__thread )
+		fi
+
+		myconf+=( --disable-sanity-checks )
+		addons="linuxthreads${addons}"
+		myconf+=( --enable-kernel=${LT_KER_VER} )
+	elif [[ $1 == "nptl" ]] ; then
+		# Newer versions require nptl, so there is no addon for it.
+		version_is_at_least 2.20 || addons="nptl${addons}"
+		myconf+=( --enable-kernel=${NPTL_KERN_VER} )
+	else
+		die "invalid pthread option"
+	fi
+	myconf+=( --enable-add-ons="${addons#,}" )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		--sysconfdir="${EPREFIX}/etc"
+		--localstatedir="${EPREFIX}/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=http://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(in_iuse rpc && use_enable rpc obsolete-rpc || echo --enable-obsolete-rpc)
+		$(in_iuse systemtap && use_enable systemtap)
+		$(in_iuse nscd && use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	if version_is_at_least 2.23 ; then
+		myconf+=( $(use_enable vanilla timezone-tools) )
+	fi
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="${EPREFIX}/sbin"
+	export libc_cv_slibdir="${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
+
+	# Overtime, generating info pages can be painful.  So disable this for
+	# versions older than the latest stable to avoid the issue (this ver
+	# should be updated from time to time).  #464394 #465816
+	if ! version_is_at_least 2.17 ; then
+		export ac_cv_prog_MAKEINFO=:
+	fi
+
+	local builddir=$(builddir "$1")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+			mkdir -p sunrpc
+			cp $(which rpcgen) sunrpc/cross-rpcgen || die
+			touch -t 202001010101 sunrpc/cross-rpcgen || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+	if ! version_is_at_least 2.25 ; then
+		vars+=(
+			libc_cv_predef_stack_protector=no
+		)
+	fi
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+		if version_is_at_least 2.21 ; then
+			# Force the mips ABI to the default.  This is OK because the set of
+			# installed headers in this phase is the same between the 3 ABIs.
+			# If this ever changes, this hack will break, but that's unlikely
+			# as glibc discourages that behavior.
+			# https://crbug.com/647033
+			sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+		fi
+		popd >/dev/null
+	fi
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		${EXTRA_ECONF}
+	)
+
+	local addons
+	[[ -d ${S}/ports ]] && addons+=",ports"
+	# Newer versions require nptl, so there is no addon for it.
+	version_is_at_least 2.20 || addons+=",nptl"
+	myconf+=( --enable-add-ons="${addons#,}" )
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	CC="$(tc-getBUILD_CC)" \
+	CFLAGS="-O1 -pipe" \
+	CPPFLAGS="-U_FORTIFY_SOURCE" \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		want_linuxthreads && glibc_do_configure linuxthreads
+		want_nptl && glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	local t
+	for t in linuxthreads nptl ; do
+		if want_${t} ; then
+			emake -C "$(builddir ${t})" || die "make ${t} for ${ABI} failed"
+		fi
+	done
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir $1)"
+	nonfatal emake -j1 check && return 0
+	einfo "make check failed - re-running with --keep-going to get the rest of the results"
+	nonfatal emake -j1 -k check
+	ewarn "make check failed for ${ABI}-${CTARGET}-$1"
+	return 1
+}
+
+glibc_do_src_test() {
+	local ret=0 t
+	for t in linuxthreads nptl ; do
+		if want_${t} ; then
+			glibc_src_test ${t}
+			: $(( ret |= $? ))
+		fi
+	done
+	return ${ret}
+}
+
+src_test() {
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi toolchain-glibc_do_src_test || die "tests failed"
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir $(want_linuxthreads && echo linuxthreads || echo nptl))
+	cd "${builddir}"
+
+	emake install_root="${D}$(alt_prefix)" install || die
+
+	if want_linuxthreads && want_nptl ; then
+		einfo "Installing NPTL to $(alt_libdir)/tls/..."
+		cd "$(builddir nptl)"
+		dodir $(alt_libdir)/tls $(alt_usrlibdir)/nptl
+
+		local l src_lib
+		for l in libc libm librt libpthread libthread_db ; do
+			# take care of shared lib first ...
+			l=${l}.so
+			if [[ -e ${l} ]] ; then
+				src_lib=${l}
+			else
+				src_lib=$(eval echo */${l})
+			fi
+			cp -a ${src_lib} "${ED}"$(alt_libdir)/tls/${l} || die "copying nptl ${l}"
+			fperms a+rx $(alt_libdir)/tls/${l}
+			dosym ${l} $(alt_libdir)/tls/$(scanelf -qSF'%S#F' ${src_lib})
+
+			# then grab the linker script or the symlink ...
+			if [[ -L ${ED}$(alt_usrlibdir)/${l} ]] ; then
+				dosym $(alt_libdir)/tls/${l} $(alt_usrlibdir)/nptl/${l}
+			else
+				sed \
+					-e "s:/${l}:/tls/${l}:g" \
+					-e "s:/${l/%.so/_nonshared.a}:/nptl/${l/%.so/_nonshared.a}:g" \
+					"${ED}"$(alt_usrlibdir)/${l} > "${ED}"$(alt_usrlibdir)/nptl/${l}
+			fi
+
+			# then grab the static lib ...
+			src_lib=${src_lib/%.so/.a}
+			[[ ! -e ${src_lib} ]] && src_lib=${src_lib/%.a/_pic.a}
+			cp -a ${src_lib} "${ED}"$(alt_usrlibdir)/nptl/ || die "copying nptl ${src_lib}"
+			src_lib=${src_lib/%.a/_nonshared.a}
+			if [[ -e ${src_lib} ]] ; then
+				cp -a ${src_lib} "${ED}"$(alt_usrlibdir)/nptl/ || die "copying nptl ${src_lib}"
+			fi
+		done
+
+		# use the nptl linker instead of the linuxthreads one as the linuxthreads
+		# one may lack TLS support and that can be really bad for business
+		cp -a elf/ld.so "${ED}"$(alt_libdir)/$(scanelf -qSF'%S#F' elf/ld.so) || die "copying nptl interp"
+	fi
+
+	# Normally real_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+	# Newer versions get fancy with libm linkage to include vectorized support.
+	# While we don't really need a ldscript here, portage QA checks get upset.
+	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		dosym ../../$(get_libdir)/libm-${upstream_pv}.so $(alt_usrlibdir)/libm-${upstream_pv}.so
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if in_iuse suid && ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		cd "${ED}"$(alt_libdir)/..
+		[[ -e lib ]] || mkdir lib
+		cd "${ED}"$(alt_usrlibdir)/..
+		[[ -e lib ]] || mkdir lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen || die
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen || die
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym /usr/$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf || die
+	doins "${WORKDIR}"/extra/etc/*.conf || die
+
+	if ! in_iuse nscd || use nscd ; then
+		doinitd "${WORKDIR}"/extra/etc/nscd || die
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+		version_is_at_least 2.16 || nscd_args+=( -e 's: --foreground : :' )
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		# Newer versions of glibc include the nscd.service themselves.
+		# TODO: Drop the $FILESDIR copy once 2.19 goes stable.
+		if version_is_at_least 2.19 ; then
+			systemd_dounit nscd/nscd.service || die
+			systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf || die
+		else
+			systemd_dounit "${FILESDIR}"/nscd.service || die
+			systemd_newtmpfilesd "${FILESDIR}"/nscd.tmpfilesd nscd.conf || die
+		fi
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc || die
+
+	for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}$(alt_prefix)" install-headers || die
+	if ! version_is_at_least 2.16 ; then
+		insinto $(alt_headers)/bits
+		doins bits/stdio_lim.h || die
+	fi
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h || die "doins include gnu"
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+	src_strip
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		elog "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ ${ROOT} != "/" ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+	fi
+
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		# if the host locales.gen contains no entries, we'll install everything
+		local locale_list="${EROOT}etc/locale.gen"
+		if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+			ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+			locale_list="${EROOT}usr/share/i18n/SUPPORTED"
+		fi
+		locale-gen -j $(makeopts_jobs) --config "${locale_list}"
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-09 21:23 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-09 21:23 UTC (permalink / raw
  To: gentoo-commits

commit:     97d60d19aa080ba85e9c51b3833bf813ec163bec
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Sep  5 20:18:37 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Sep  9 21:21:29 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=97d60d19

sys-libs/glibc: Simplification, removing a lot of outdated cruft and black magic

 sys-libs/glibc/glibc-2.26-r1.ebuild | 344 ++++++++++++------------------------
 1 file changed, 109 insertions(+), 235 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r1.ebuild b/sys-libs/glibc/glibc-2.26-r1.ebuild
index 98b89a06c6f..450e89d8f74 100644
--- a/sys-libs/glibc/glibc-2.26-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r1.ebuild
@@ -3,34 +3,40 @@
 
 EAPI=6
 
-inherit toolchain-glibc
+inherit prefix toolchain-glibc
 
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # strip ourself #46186
+RESTRICT="strip" # Strip ourself #46186
 EMULTILIB_PKG="true"
 
 # Configuration variables
 
 if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
+	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
+	inherit git-r3
 else
 	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	KEYWORDS=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 
 RELEASE_VER=${PV}
 
 GCC_BOOTSTRAP_VER="4.7.3-r1"
-# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="0"                                  # Gentoo patchset
-: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
 
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+# Gentoo patchset
+PATCH_VER="0"
+
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
+
+IUSE="audit caps debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Min kernel version nptl requires
+: ${NPTL_KERN_VER:="2.6.32"}
 
 # Here's how the cross-compile logic breaks down ...
 #  CTARGET - machine that will target the binaries
@@ -58,8 +64,6 @@ is_crosscompile() {
 	[[ ${CHOST} != ${CTARGET} ]]
 }
 
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
 SLOT="2.2"
 
 # General: We need a new-enough binutils/gcc to match upstream baseline.
@@ -75,11 +79,13 @@ COMMON_DEPEND="
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
 	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2"
+	!<sys-apps/portage-2.1.2
+"
 RDEPEND="${COMMON_DEPEND}
 	!sys-kernel/ps3-sources
 	sys-apps/gentoo-functions
-	!sys-libs/nss-db"
+	!sys-libs/nss-db
+"
 
 if [[ ${CATEGORY} == cross-* ]] ; then
 	DEPEND+=" !crosscompile_opts_headers-only? (
@@ -91,33 +97,23 @@ else
 	DEPEND+="
 		>=sys-devel/binutils-2.24
 		>=sys-devel/gcc-4.7
-		virtual/os-headers"
+		virtual/os-headers
+	"
 	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
 	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
 fi
 
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~tamiko/distfiles/URI HTTP~dilfridge/distfiles/URI HTTP~slyfox/distfiles/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
-}
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
-
 #
 # the phases
 #
 
 pkg_pretend() {
-    check_devpts
+	die "This is work in progress. DONT try to use it. dilfridge"
 
-	# Prevent native builds from downgrading.
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
 	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
 	   [[ ${ROOT} == "/" ]] && \
 	   [[ ${CBUILD} == ${CHOST} ]] && \
@@ -128,7 +124,7 @@ pkg_pretend() {
 		if has_version ">${CATEGORY}/${P}-r10000" ; then
 			eerror "Sanity check to keep you from breaking your system:"
 			eerror " Downgrading glibc is not supported and a sure way to destruction"
-			die "aborting to save your system"
+			die "Aborting to save your system"
 		fi
 
 		if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
@@ -136,31 +132,31 @@ pkg_pretend() {
 			eerror "Your patched vendor kernel is broken.  You need to get an"
 			eerror "update from whoever is providing the kernel to you."
 			eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227"
-			eerror "http://bugs.gentoo.org/262698"
-			die "keeping your system alive, say thank you"
+			eerror "https://bugs.gentoo.org/262698"
+			die "Keeping your system alive, say thank you"
 		fi
 
 		if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
 		then
 			eerror "Your old kernel is broken.  You need to update it to"
 			eerror "a newer version as syscall(<bignum>) will break."
-			eerror "http://bugs.gentoo.org/279260"
-			die "keeping your system alive, say thank you"
+			eerror "https://bugs.gentoo.org/279260"
+			die "Keeping your system alive, say thank you"
 		fi
 	fi
 
-	# users have had a chance to phase themselves, time to give em the boot
+	# Users have had a chance to phase themselves, time to give em the boot
 	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
 		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
 		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "lazy upgrader detected"
+		die "Lazy upgrader detected"
 	fi
 
 	if [[ ${CTARGET} == i386-* ]] ; then
 		eerror "i386 CHOSTs are no longer supported."
 		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read http://www.gentoo.org/doc/en/change-chost.xml"
-		die "please fix your CHOST"
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
 	fi
 
 	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
@@ -198,61 +194,37 @@ pkg_pretend() {
 }
 
 src_unpack() {
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
 
 	setup_env
 
 	# Check NPTL support _before_ we unpack things to save some time
-	want_nptl && check_nptl_support
-
-	if [[ -n ${EGIT_REPO_URIS} ]] ; then
-		local i d
-		for ((i=0; i<${#EGIT_REPO_URIS[@]}; ++i)) ; do
-			EGIT_REPO_URI=${EGIT_REPO_URIS[$i]}
-			EGIT_SOURCEDIR=${EGIT_SOURCEDIRS[$i]}
-			git-2_src_unpack
-		done
+	check_nptl_support
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
 	else
-		unpack_pkg
+		unpack ${PN}.tar.xz
 	fi
 
 	cd "${S}"
 	touch locale/C-translit.h #185476 #218003
-	[[ -n ${LT_VER}     ]] && unpack_pkg linuxthreads ${LT_VER}
-	[[ -n ${PORTS_VER}  ]] && unpack_pkg ports ${PORTS_VER}
-	[[ -n ${LIBIDN_VER} ]] && unpack_pkg libidn
-
-	if [[ -n ${PATCH_VER} ]] ; then
-		cd "${WORKDIR}"
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
-		# pull out all the addons
-		local d
-		for d in extra/*/configure ; do
-			d=${d%/configure}
-			[[ -d ${S}/${d} ]] && die "${d} already exists in \${S}"
-			mv "${d}" "${S}" || die "moving ${d} failed"
-		done
-	fi
+
+	cd "${WORKDIR}"
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
+	# pull out all the addons
+	local d
+	for d in extra/*/configure ; do
+		d=${d%/configure}
+		[[ -d ${S}/${d} ]] && die "${d} already exists in \${S}"
+		mv "${d}" "${S}" || die "moving ${d} failed"
+	done
 }
 
 src_prepare() {
-	# XXX: We should do the branchupdate, before extracting the manpages and
-	# infopages else it does not help much (mtimes change if there is a change
-	# to them with branchupdate)
-	if [[ -n ${BRANCH_UPDATE} ]] ; then
-		epatch "${DISTDIR}"/glibc-${RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
-
-		# Snapshot date patch
-		einfo "Patching version to display snapshot date ..."
-		sed -i -e "s:\(#define RELEASE\).*:\1 \"${BRANCH_UPDATE}\":" version.h
-	fi
-
-	if [[ -n ${PATCH_VER} ]] && ! use vanilla ; then
-		EPATCH_MULTI_MSG="Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER} ..." \
-		EPATCH_EXCLUDE=${GLIBC_PATCH_EXCLUDE} \
-		EPATCH_SUFFIX="patch" \
-		ARCH=$(tc-arch) \
-		epatch "${WORKDIR}"/patches
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER} ..."
+		eapply "${WORKDIR}"/patches/*.patch
 	fi
 
 	if just_headers ; then
@@ -265,7 +237,7 @@ src_prepare() {
 		fi
 	fi
 
-	eapply_user
+	default
 
 	gnuconfig_update
 
@@ -301,7 +273,7 @@ src_prepare() {
 	4.8.[0-3]|4.9.0)
 		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
 		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
-		die "need to switch compilers #547420"
+		die "Need to switch compilers #547420"
 		;;
 	esac
 }
@@ -310,7 +282,17 @@ glibc_do_configure() {
 	# Glibc does not work with gold (for various reasons) #269274.
 	tc-ld-disable-gold
 
-	dump_toolchain_settings "Configuring glibc for $1"
+	einfo "Configuring glibc for $1"
+
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC LD {AS,C,CPP,CXX,LD}FLAGS ; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+
+	# The glibc configure script doesn't properly use LDFLAGS all the time.
+	export CC="$(tc-getCC ${CTARGET}) ${LDFLAGS}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+	echo
 
 	local myconf=()
 
@@ -326,41 +308,12 @@ glibc_do_configure() {
 	[[ -d ports ]] && addons+=",ports"
 	popd > /dev/null
 
-	if has_version '<sys-libs/glibc-2.13' ; then
-		myconf+=( --enable-old-ssp-compat )
-	fi
-
-	if version_is_at_least 2.25 ; then
-		myconf+=( --enable-stack-protector=all )
-	fi
-
-	if version_is_at_least 2.25 ; then
-		myconf+=( --enable-stackguard-randomization )
-	else
-		myconf+=( $(use_enable hardened stackguard-randomization) )
-	fi
+	myconf+=( --enable-stack-protector=all )
+	myconf+=( --enable-stackguard-randomization )
 
 	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
 
-	if [[ $1 == "linuxthreads" ]] ; then
-		if want_tls ; then
-			myconf+=( --with-tls )
-
-			if ! want__thread || use glibc-compat20 || [[ ${LT_KER_VER} == 2.[02].* ]] ; then
-				myconf+=( --without-__thread )
-			else
-				myconf+=( --with-__thread )
-			fi
-		else
-			myconf+=( --without-tls --without-__thread )
-		fi
-
-		myconf+=( --disable-sanity-checks )
-		addons="linuxthreads${addons}"
-		myconf+=( --enable-kernel=${LT_KER_VER} )
-	elif [[ $1 == "nptl" ]] ; then
-		# Newer versions require nptl, so there is no addon for it.
-		version_is_at_least 2.20 || addons="nptl${addons}"
+	if [[ $1 == "nptl" ]] ; then
 		myconf+=( --enable-kernel=${NPTL_KERN_VER} )
 	else
 		die "invalid pthread option"
@@ -409,19 +362,16 @@ glibc_do_configure() {
 		--mandir='$(prefix)'/share/man
 		--infodir='$(prefix)'/share/info
 		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=http://bugs.gentoo.org/
+		--with-bugurl=https://bugs.gentoo.org/
 		--with-pkgversion="$(glibc_banner)"
 		$(use_multiarch || echo --disable-multi-arch)
-		$(in_iuse rpc && use_enable rpc obsolete-rpc || echo --enable-obsolete-rpc)
 		$(in_iuse systemtap && use_enable systemtap)
 		$(in_iuse nscd && use_enable nscd)
 		${EXTRA_ECONF}
 	)
 
 	# We rely on sys-libs/timezone-data for timezone tools normally.
-	if version_is_at_least 2.23 ; then
-		myconf+=( $(use_enable vanilla timezone-tools) )
-	fi
+	myconf+=( $(use_enable vanilla timezone-tools) )
 
 	# These libs don't have configure flags.
 	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
@@ -437,13 +387,6 @@ glibc_do_configure() {
 	# this overriding check.  #347761
 	export libc_cv_hashstyle=no
 
-	# Overtime, generating info pages can be painful.  So disable this for
-	# versions older than the latest stable to avoid the issue (this ver
-	# should be updated from time to time).  #464394 #465816
-	if ! version_is_at_least 2.17 ; then
-		export ac_cv_prog_MAKEINFO=:
-	fi
-
 	local builddir=$(builddir "$1")
 	mkdir -p "${builddir}"
 	cd "${builddir}"
@@ -512,11 +455,7 @@ glibc_headers_configure() {
 		ac_cv_lib_audit_audit_log_user_avc_message=no
 		ac_cv_lib_cap_cap_init=no
 	)
-	if ! version_is_at_least 2.25 ; then
-		vars+=(
-			libc_cv_predef_stack_protector=no
-		)
-	fi
+
 	einfo "Forcing cached settings:"
 	for v in "${vars[@]}" ; do
 		einfo " ${v}"
@@ -528,14 +467,14 @@ glibc_headers_configure() {
 		pushd "${S}"/sysdeps/mips >/dev/null
 		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
 		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-		if version_is_at_least 2.21 ; then
-			# Force the mips ABI to the default.  This is OK because the set of
-			# installed headers in this phase is the same between the 3 ABIs.
-			# If this ever changes, this hack will break, but that's unlikely
-			# as glibc discourages that behavior.
-			# https://crbug.com/647033
-			sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-		fi
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
 		popd >/dev/null
 	fi
 
@@ -555,8 +494,6 @@ glibc_headers_configure() {
 
 	local addons
 	[[ -d ${S}/ports ]] && addons+=",ports"
-	# Newer versions require nptl, so there is no addon for it.
-	version_is_at_least 2.20 || addons+=",nptl"
 	myconf+=( --enable-add-ons="${addons#,}" )
 
 	# Nothing is compiled here which would affect the headers for the target.
@@ -574,8 +511,7 @@ do_src_configure() {
 	if just_headers ; then
 		glibc_headers_configure
 	else
-		want_linuxthreads && glibc_do_configure linuxthreads
-		want_nptl && glibc_do_configure nptl
+		glibc_do_configure nptl
 	fi
 }
 
@@ -584,12 +520,7 @@ src_configure() {
 }
 
 do_src_compile() {
-	local t
-	for t in linuxthreads nptl ; do
-		if want_${t} ; then
-			emake -C "$(builddir ${t})" || die "make ${t} for ${ABI} failed"
-		fi
-	done
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
 }
 
 src_compile() {
@@ -602,21 +533,15 @@ src_compile() {
 
 glibc_src_test() {
 	cd "$(builddir $1)"
-	nonfatal emake -j1 check && return 0
-	einfo "make check failed - re-running with --keep-going to get the rest of the results"
-	nonfatal emake -j1 -k check
-	ewarn "make check failed for ${ABI}-${CTARGET}-$1"
-	return 1
+	emake -j1 check
 }
 
-glibc_do_src_test() {
-	local ret=0 t
-	for t in linuxthreads nptl ; do
-		if want_${t} ; then
-			glibc_src_test ${t}
-			: $(( ret |= $? ))
-		fi
-	done
+do_src_test() {
+	local ret=0
+
+	glibc_src_test nptl
+	: $(( ret |= $? ))
+
 	return ${ret}
 }
 
@@ -624,62 +549,20 @@ src_test() {
 	# Give tests more time to complete.
 	export TIMEOUTFACTOR=5
 
-	foreach_abi toolchain-glibc_do_src_test || die "tests failed"
+	foreach_abi do_src_test || die "tests failed"
 }
 
 glibc_do_src_install() {
-	local builddir=$(builddir $(want_linuxthreads && echo linuxthreads || echo nptl))
+	local builddir=$(builddir nptl)
 	cd "${builddir}"
 
 	emake install_root="${D}$(alt_prefix)" install || die
 
-	if want_linuxthreads && want_nptl ; then
-		einfo "Installing NPTL to $(alt_libdir)/tls/..."
-		cd "$(builddir nptl)"
-		dodir $(alt_libdir)/tls $(alt_usrlibdir)/nptl
-
-		local l src_lib
-		for l in libc libm librt libpthread libthread_db ; do
-			# take care of shared lib first ...
-			l=${l}.so
-			if [[ -e ${l} ]] ; then
-				src_lib=${l}
-			else
-				src_lib=$(eval echo */${l})
-			fi
-			cp -a ${src_lib} "${ED}"$(alt_libdir)/tls/${l} || die "copying nptl ${l}"
-			fperms a+rx $(alt_libdir)/tls/${l}
-			dosym ${l} $(alt_libdir)/tls/$(scanelf -qSF'%S#F' ${src_lib})
-
-			# then grab the linker script or the symlink ...
-			if [[ -L ${ED}$(alt_usrlibdir)/${l} ]] ; then
-				dosym $(alt_libdir)/tls/${l} $(alt_usrlibdir)/nptl/${l}
-			else
-				sed \
-					-e "s:/${l}:/tls/${l}:g" \
-					-e "s:/${l/%.so/_nonshared.a}:/nptl/${l/%.so/_nonshared.a}:g" \
-					"${ED}"$(alt_usrlibdir)/${l} > "${ED}"$(alt_usrlibdir)/nptl/${l}
-			fi
-
-			# then grab the static lib ...
-			src_lib=${src_lib/%.so/.a}
-			[[ ! -e ${src_lib} ]] && src_lib=${src_lib/%.a/_pic.a}
-			cp -a ${src_lib} "${ED}"$(alt_usrlibdir)/nptl/ || die "copying nptl ${src_lib}"
-			src_lib=${src_lib/%.a/_nonshared.a}
-			if [[ -e ${src_lib} ]] ; then
-				cp -a ${src_lib} "${ED}"$(alt_usrlibdir)/nptl/ || die "copying nptl ${src_lib}"
-			fi
-		done
-
-		# use the nptl linker instead of the linuxthreads one as the linuxthreads
-		# one may lack TLS support and that can be really bad for business
-		cp -a elf/ld.so "${ED}"$(alt_libdir)/$(scanelf -qSF'%S#F' elf/ld.so) || die "copying nptl interp"
-	fi
-
 	# Normally real_pv is ${PV}. Live ebuilds are exception, there we need
 	# to infer upstream version:
 	# '#define VERSION "2.26.90"' -> '2.26.90'
 	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
 	# Newer versions get fancy with libm linkage to include vectorized support.
 	# While we don't really need a ldscript here, portage QA checks get upset.
 	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
@@ -777,10 +660,10 @@ glibc_do_src_install() {
 		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
 		|| die "generating /usr/share/i18n/SUPPORTED failed"
 	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen || die
+	dosbin locale-gen
 	doman *.[0-8]
 	insinto /etc
-	doins locale.gen || die
+	doins locale.gen
 
 	# Make sure all the ABI's can find the locales and so we only
 	# have to generate one set
@@ -796,34 +679,27 @@ glibc_do_src_install() {
 
 	# Install misc network config files
 	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf || die
-	doins "${WORKDIR}"/extra/etc/*.conf || die
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
 
-	if ! in_iuse nscd || use nscd ; then
-		doinitd "${WORKDIR}"/extra/etc/nscd || die
+	if use nscd ; then
+		doinitd "${WORKDIR}"/extra/etc/nscd
 
 		local nscd_args=(
 			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
 		)
-		version_is_at_least 2.16 || nscd_args+=( -e 's: --foreground : :' )
+
 		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
 
-		# Newer versions of glibc include the nscd.service themselves.
-		# TODO: Drop the $FILESDIR copy once 2.19 goes stable.
-		if version_is_at_least 2.19 ; then
-			systemd_dounit nscd/nscd.service || die
-			systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf || die
-		else
-			systemd_dounit "${FILESDIR}"/nscd.service || die
-			systemd_newtmpfilesd "${FILESDIR}"/nscd.tmpfilesd nscd.conf || die
-		fi
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
 	else
 		# Do this since extra/etc/*.conf above might have nscd.conf.
 		rm -f "${ED}"/etc/nscd.conf
 	fi
 
 	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc || die
+	doenvd "${T}"/00glibc
 
 	for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
 		[[ -s ${d} ]] && dodoc ${d}
@@ -837,13 +713,11 @@ glibc_do_src_install() {
 glibc_headers_install() {
 	local builddir=$(builddir "headers")
 	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers || die
-	if ! version_is_at_least 2.16 ; then
-		insinto $(alt_headers)/bits
-		doins bits/stdio_lim.h || die
-	fi
+	emake install_root="${D}$(alt_prefix)" install-headers
+
 	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h || die "doins include gnu"
+	doins "${S}"/include/gnu/stubs.h
+
 	# Make sure we install the sys-include symlink so that when
 	# we build a 2nd stage cross-compiler, gcc finds the target
 	# system headers correctly.  See gcc/doc/gccinstall.info


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-09 21:43 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-09 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     fc75e20d0440e340215047019eb51d31adeb4339
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  9 21:43:23 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Sep  9 21:43:23 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc75e20d

sys-libs/glibc: D'oh (1).

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/glibc-2.26-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r1.ebuild b/sys-libs/glibc/glibc-2.26-r1.ebuild
index 450e89d8f74..87afd869445 100644
--- a/sys-libs/glibc/glibc-2.26-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r1.ebuild
@@ -204,7 +204,7 @@ src_unpack() {
 	if [[ -n ${EGIT_REPO_URI} ]] ; then
 		git-r3_src_unpack
 	else
-		unpack ${PN}.tar.xz
+		unpack ${P}.tar.xz
 	fi
 
 	cd "${S}"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-10  8:19 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-10  8:19 UTC (permalink / raw
  To: gentoo-commits

commit:     ace96f7971f5fa2aafbc20e5744d5734efa48d08
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 10 08:19:13 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Sep 10 08:19:36 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ace96f79

sys-libs/glibc: Remove "die" guard. Seems safe enough for an unkeyworded ebuild.

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/glibc-2.26-r1.ebuild | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r1.ebuild b/sys-libs/glibc/glibc-2.26-r1.ebuild
index 87afd869445..9876c073967 100644
--- a/sys-libs/glibc/glibc-2.26-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r1.ebuild
@@ -108,8 +108,6 @@ fi
 #
 
 pkg_pretend() {
-	die "This is work in progress. DONT try to use it. dilfridge"
-
 	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
 	check_devpts
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-10 10:08 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-10 10:08 UTC (permalink / raw
  To: gentoo-commits

commit:     0985a8297b958391afff2e607a2ec7240cad050a
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 10 10:07:40 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Sep 10 10:07:56 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0985a829

sys-libs/glibc: Fix part of the test build system, bug 623548

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/glibc-2.26-r1.ebuild | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r1.ebuild b/sys-libs/glibc/glibc-2.26-r1.ebuild
index 9876c073967..fbe7444f948 100644
--- a/sys-libs/glibc/glibc-2.26-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r1.ebuild
@@ -280,16 +280,25 @@ 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 $1"
 
 	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC LD {AS,C,CPP,CXX,LD}FLAGS ; do
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS ; do
 		einfo " $(printf '%15s' ${v}:)   ${!v}"
 	done
 
 	# The glibc configure script doesn't properly use LDFLAGS all the time.
 	export CC="$(tc-getCC ${CTARGET}) ${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)"
+	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
+
 	echo
 
 	local myconf=()


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-10 16:45 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-10 16:45 UTC (permalink / raw
  To: gentoo-commits

commit:     65b0a31d080eb74bbdca1668c2c5e2207bfee2fd
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 10 16:44:17 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Sep 10 16:44:44 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65b0a31d

sys-libs/glibc: Fix building the test suite, bug 589370

Some black vapier magic was removing all zero-length files from the working
directory. Turns out some of them are actually needed...

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/glibc-2.26-r1.ebuild | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r1.ebuild b/sys-libs/glibc/glibc-2.26-r1.ebuild
index b852aba96bc..3658a3e108a 100644
--- a/sys-libs/glibc/glibc-2.26-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r1.ebuild
@@ -240,7 +240,6 @@ src_prepare() {
 	gnuconfig_update
 
 	cd "${WORKDIR}"
-	find . -type f '(' -size 0 -o -name "*.orig" ')' -delete
 	find . -name configure -exec touch {} +
 
 	eprefixify extra/locale/locale-gen


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-11 10:20 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-11 10:20 UTC (permalink / raw
  To: gentoo-commits

commit:     d37fe4dab16f217360d17e6be0299d5c83f155f0
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 11 10:18:47 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Sep 11 10:20:01 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d37fe4da

sys-libs/glibc: Add missing dependency on systemtap, bug 466176

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/glibc-2.26-r1.ebuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys-libs/glibc/glibc-2.26-r1.ebuild b/sys-libs/glibc/glibc-2.26-r1.ebuild
index 3658a3e108a..d7692868c3f 100644
--- a/sys-libs/glibc/glibc-2.26-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r1.ebuild
@@ -75,6 +75,7 @@ COMMON_DEPEND="
 	) )
 	suid? ( caps? ( sys-libs/libcap ) )
 	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-11 12:13 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-11 12:13 UTC (permalink / raw
  To: gentoo-commits

commit:     c0ef542783db8479c2557041eb6e2314b8220b6c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 11 12:13:03 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Sep 11 12:13:30 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c0ef5427

sys-libs/glibc: Revision bump to include some more upstream fixes (patchlevel 9)

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/Manifest             |   1 +
 sys-libs/glibc/glibc-2.25-r5.ebuild | 151 ++++++++++++++++++++++++++++++++++++
 2 files changed, 152 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 082bd06d9a6..9797c36c244 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,6 +20,7 @@ DIST glibc-2.24.tar.xz 13554048 SHA256 99d4a3e8efd144d71488e478f62587578c0f4e1fa
 DIST glibc-2.25-patches-5.tar.bz2 44356 SHA256 d9ea3908c8c4d561d22697d9830b4032cbbba46822613d5a3509d3b7e579c016 SHA512 ad3acf760e6cd714fe5d6833b53d8759e09c74ca60fbfd173e87dbb2d1062a5006427ca17db0b6ce695dae03e2ace7dc30992ae9b08e94ae4350b19ea03acdcc WHIRLPOOL 1fa660852f9e42fda956b4924351a532efdca88691cb2855c458e8bb9af1fc3cbdf2eb9c8ce93a7c57fa2d6a7e20b1c1a5c17d29b0d07f8e44e0ed8fdb7db8bc
 DIST glibc-2.25-patches-7.tar.bz2 46222 SHA256 af1a3c13409599486d58c531d04d794698b1ac04cc883dbdb0d29af7b44d7ca5 SHA512 21637f3b1a20cef55ce52311bc7b4d60d93b6f04a8d45944ccb9286fc330e262c6f37f729b7f5a5daec588821e8ae330f89cb7f7e84463b4e533aa80f408e415 WHIRLPOOL bc48fa53ddd264559378e8075c42bd38fd49015ac76834aaed7e0ec338dbbba1f4fdc1d2aaea6d53d72bbbaef99920cad489188b95cd0ec06b02ce5def110c11
 DIST glibc-2.25-patches-8.tar.bz2 47110 SHA256 1dc41664153369886d240a1851b15bf0c3c3739c8319e6d68cb0c2f85fc98901 SHA512 41d772c47770a63502c863f3c9bb05164e0ceab69fb7b7f355c25685ae4285d73e9ab0e3836162bd11852339055329d0bdc7238f3191fde39a50ce0d9a60454c WHIRLPOOL c6e0443d75e2e4607226caa4df1ce2b10ef21ec2564b447e2a287888d1f593d51f334a6e1ab942f5d1602d02c6fee87ce4ef9a7db3409de6063bc377a470a42d
+DIST glibc-2.25-patches-9.tar.bz2 67901 SHA256 cbd8af837aa0776940fd41e34874e930a7f25d78cdd212e138dd9a85e1349519 SHA512 b4f0be5b20834aff102394df23084cc0adf1ab674e6ce050550f6b6658cf0eab57f7685cac079b1a19388dba927a36b8ca31f58af3dddc559d7230674ffd59b5 WHIRLPOOL 81c18056fe26a79c7a7598da1181ba02e83daf7d9e9883a3c1195804a35fe22a79d7cc4a8411f2f4a4ce6430e506978199f59b61d3ed0a70b4e4f7dd05ecfafe
 DIST glibc-2.25.tar.xz 13873900 SHA256 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e WHIRLPOOL dc2fafaa4a0e5581268338453838a03ed0c5e7a2af844e8fb7086ab8d3ae48efbdbe6f25db1d089ae669cd2f8b0412f690d965506753d86f8525da2df59b7953
 DIST glibc-2.26-patches-0.tar.bz2 22289 SHA256 4b59db44f22c415a3c30a543927e69c04d15ef5d9d5f2ce63eba30e0354ebbd1 SHA512 4afb828d2897c68c7a16e42a2c38a872d38c42954a626d0650cc3fface907d28ba4f5b50504aa4e6c465c5b9c37ab0014d2d228b29ac50335aeb85fec713fd78 WHIRLPOOL 6fa2ad2be084e14e4e9105947232a6b5057d23dd0b55b40bd15bb48c84bfb492a22a27d8a3358f6cc1335b7c9652a0be2d7a977eb266dd08d531ecee12449184
 DIST glibc-2.26.tar.xz 14682748 SHA256 e54e0a934cd2bc94429be79da5e9385898d2306b9eaf3c92d5a77af96190f6bd SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0 WHIRLPOOL 9091c3bccc9b590de6b9595aa391ba01091f0c301bd9199d7c48fbeaeeb013ec9c683c68b65b59c5a69e3905b7f842cca1b0a410431967ecb3a1229b8535486f

diff --git a/sys-libs/glibc/glibc-2.25-r5.ebuild b/sys-libs/glibc/glibc-2.25-r5.ebuild
new file mode 100644
index 00000000000..0ce346e5829
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.25-r5.ebuild
@@ -0,0 +1,151 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit toolchain-glibc
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+KEYWORDS=""
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+case ${PV} in
+9999*)
+	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+	EGIT_SOURCEDIRS="${S}"
+	inherit git-2
+	;;
+*)
+	RELEASE_VER=${PV}
+	;;
+esac
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
+PATCH_VER="9"                                  # Gentoo patchset
+: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
+
+IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2"
+RDEPEND="${COMMON_DEPEND}
+	!sys-kernel/ps3-sources
+	sys-apps/gentoo-functions
+	!sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !crosscompile_opts_headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.7
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.7
+		virtual/os-headers"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+	local devspace="HTTP~vapier/dist/URI HTTP~dilfridge/distfiles/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
+	devspace=${devspace//HTTP/https://dev.gentoo.org/}
+	echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+src_unpack() {
+	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+
+	toolchain-glibc_src_unpack
+}
+
+src_prepare() {
+	toolchain-glibc_src_prepare
+
+	cd "${S}"
+
+	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
+
+	if use hardened ; then
+		# We don't enable these for non-hardened as the output is very terse --
+		# it only states that a crash happened.  The default upstream behavior
+		# includes backtraces and symbols.
+		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
+
+		if use debug ; then
+			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+			sed -i \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				debug/Makefile || die
+		fi
+	fi
+
+	case $(gcc-fullversion) in
+	4.8.[0-3]|4.9.0)
+		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
+		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
+		die "need to switch compilers #547420"
+		;;
+	esac
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-11 12:16 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-11 12:16 UTC (permalink / raw
  To: gentoo-commits

commit:     78527a00ee720e32ca54a3c15335fe6e41d95e27
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 11 12:15:03 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Sep 11 12:15:03 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=78527a00

sys-libs/glibc: Clean up

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/Manifest             |   3 -
 sys-libs/glibc/glibc-2.24-r4.ebuild | 155 ------------------------------------
 sys-libs/glibc/glibc-2.25-r2.ebuild | 150 ----------------------------------
 sys-libs/glibc/glibc-2.25-r3.ebuild | 150 ----------------------------------
 4 files changed, 458 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 9797c36c244..b8d66c32d1a 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,11 +14,8 @@ DIST glibc-2.22.tar.xz 12969072 SHA256 eb731406903befef1d8f878a46be75ef862b9056a
 DIST glibc-2.23-patches-7.tar.bz2 315221 SHA256 97ef9e370ce9b09d8e9b9f6239f7ef94dd837d29b7bfc1404438c63da1d534ac SHA512 c0d0cab0a370acef0b085b0ab09ce868425a12bbb371d0a9ff91dc83a74a0d8d3b541d10c44650b00b7cb155f8ac1f87764e6a6bd9d6bae8a9a904b4df1650ef WHIRLPOOL 128ea1a2eeaad3d95cdf1054d10232a34e8f88d10ed8907a67d9ff02734243d20b21595ca3698a4861d9c65e2a59aedbcf8e399bd1ed879dba1556ce2995ad9b
 DIST glibc-2.23-patches-8.tar.bz2 304199 SHA256 6110777176abfb8d287d82804d98e007c255db6040a1beca589a212772c90482 SHA512 470814bbbd9d4ee5fa2dd7570a2e14b0229723e373e801472856fd6c2f089499eddc300f69b49af8ba0edbdca583ee3ca521fdb5c642509717cafea0ad925fd2 WHIRLPOOL 1ef9a431d67d7669f34f7db21185d50ddd6dc82c549a9ff274f0b98454417f4098ee771bfe10073be12d3c153ee46ff36e40b46ecb31844ab09791ae29b49074
 DIST glibc-2.23.tar.xz 13455260 SHA256 94efeb00e4603c8546209cefb3e1a50a5315c86fa9b078b6fad758e187ce13e9 SHA512 b82953388cd028e174cb08f082557bbce0dad8b67b17d31b29f90102fd52a51e03d591448ecb64882a1c1d5303afffc7f6ede85cee4c784a9284fbc9b4ad26cf WHIRLPOOL 7c7e3bf55a89a04bac917b9ca5a1cbb1613f22c427d2766f114b5a36f9635856005b823852ef5d3b73462b577fe4e5865e68e7b64633d48a95fa1e5eaa831a71
-DIST glibc-2.24-patches-10.tar.bz2 73586 SHA256 d479033b63ff796fea56fb1bde390c442021acd856994b15c983b4a89e46fbbe SHA512 fc9191a85da53a2515bbaab228648936682e04267284049468e0c82284f618ab2907b9247baca701e16edc50640199ff6d8e2a6a93ccbd5a9d3b0eb73cc484ca WHIRLPOOL 7afe94307900a70de2f5e028d8ec9e0f4b06b661ec6493217e51a13d750f891e10b45c0f66d86fa83c16cc3ce539bb257039b33bc3e363469cd03502d956d75e
 DIST glibc-2.24-patches-8.tar.bz2 71769 SHA256 0a21549ed196c5c03efc37273fb991e199c585140d954dca61140c3d0c227af9 SHA512 897c9d158f898edb355ee6478a7e0372a29e6c9d0b98cd80ccaa3ed4f0aab35e3b038217735f2a3b6007ff0cf27c7d6b27a84daaceca9361dce04bc5b2124ada WHIRLPOOL 222b375249c5a3e53fd0116fadf9612c5e5479cd845dc3fcebb496dfe38d70d0e2c84517b79258c73afe2c1f5d15ecec768d33659c10fb15ae59b9061072987d
 DIST glibc-2.24.tar.xz 13554048 SHA256 99d4a3e8efd144d71488e478f62587578c0f4e1fa0b4eed47ee3d4975ebeb5d3 SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb WHIRLPOOL be82b47fc73f7e780e8e73a5f58b313d8e861d5ea8c4320f95ef0d8c1e125ff011d61dcfc0380be0e83868bd8c3299de1ea662da7fc8d709050e89b2c126e3eb
-DIST glibc-2.25-patches-5.tar.bz2 44356 SHA256 d9ea3908c8c4d561d22697d9830b4032cbbba46822613d5a3509d3b7e579c016 SHA512 ad3acf760e6cd714fe5d6833b53d8759e09c74ca60fbfd173e87dbb2d1062a5006427ca17db0b6ce695dae03e2ace7dc30992ae9b08e94ae4350b19ea03acdcc WHIRLPOOL 1fa660852f9e42fda956b4924351a532efdca88691cb2855c458e8bb9af1fc3cbdf2eb9c8ce93a7c57fa2d6a7e20b1c1a5c17d29b0d07f8e44e0ed8fdb7db8bc
-DIST glibc-2.25-patches-7.tar.bz2 46222 SHA256 af1a3c13409599486d58c531d04d794698b1ac04cc883dbdb0d29af7b44d7ca5 SHA512 21637f3b1a20cef55ce52311bc7b4d60d93b6f04a8d45944ccb9286fc330e262c6f37f729b7f5a5daec588821e8ae330f89cb7f7e84463b4e533aa80f408e415 WHIRLPOOL bc48fa53ddd264559378e8075c42bd38fd49015ac76834aaed7e0ec338dbbba1f4fdc1d2aaea6d53d72bbbaef99920cad489188b95cd0ec06b02ce5def110c11
 DIST glibc-2.25-patches-8.tar.bz2 47110 SHA256 1dc41664153369886d240a1851b15bf0c3c3739c8319e6d68cb0c2f85fc98901 SHA512 41d772c47770a63502c863f3c9bb05164e0ceab69fb7b7f355c25685ae4285d73e9ab0e3836162bd11852339055329d0bdc7238f3191fde39a50ce0d9a60454c WHIRLPOOL c6e0443d75e2e4607226caa4df1ce2b10ef21ec2564b447e2a287888d1f593d51f334a6e1ab942f5d1602d02c6fee87ce4ef9a7db3409de6063bc377a470a42d
 DIST glibc-2.25-patches-9.tar.bz2 67901 SHA256 cbd8af837aa0776940fd41e34874e930a7f25d78cdd212e138dd9a85e1349519 SHA512 b4f0be5b20834aff102394df23084cc0adf1ab674e6ce050550f6b6658cf0eab57f7685cac079b1a19388dba927a36b8ca31f58af3dddc559d7230674ffd59b5 WHIRLPOOL 81c18056fe26a79c7a7598da1181ba02e83daf7d9e9883a3c1195804a35fe22a79d7cc4a8411f2f4a4ce6430e506978199f59b61d3ed0a70b4e4f7dd05ecfafe
 DIST glibc-2.25.tar.xz 13873900 SHA256 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e WHIRLPOOL dc2fafaa4a0e5581268338453838a03ed0c5e7a2af844e8fb7086ab8d3ae48efbdbe6f25db1d089ae669cd2f8b0412f690d965506753d86f8525da2df59b7953

diff --git a/sys-libs/glibc/glibc-2.24-r4.ebuild b/sys-libs/glibc/glibc-2.24-r4.ebuild
deleted file mode 100644
index 29a17f827ae..00000000000
--- a/sys-libs/glibc/glibc-2.24-r4.ebuild
+++ /dev/null
@@ -1,155 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit toolchain-glibc
-
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-RESTRICT="strip" # strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-RELEASE_VER=""
-case ${PV} in
-9999*)
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
-	;;
-*)
-	RELEASE_VER=${PV}
-	;;
-esac
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="10"                                 # Gentoo patchset
-: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
-
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2"
-RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	!sys-libs/nss-db"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.7
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.7
-		virtual/os-headers"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
-}
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
-
-src_unpack() {
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	toolchain-glibc_src_unpack
-}
-
-src_prepare() {
-	toolchain-glibc_src_prepare
-
-	cd "${S}"
-
-	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-
-		# Build various bits with ssp-all
-		sed -i \
-			-e 's:-fstack-protector$:-fstack-protector-all:' \
-			*/Makefile || die
-	fi
-
-	case $(gcc-fullversion) in
-	4.8.[0-3]|4.9.0)
-		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
-		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
-		die "need to switch compilers #547420"
-		;;
-	esac
-}

diff --git a/sys-libs/glibc/glibc-2.25-r2.ebuild b/sys-libs/glibc/glibc-2.25-r2.ebuild
deleted file mode 100644
index 61088f71f41..00000000000
--- a/sys-libs/glibc/glibc-2.25-r2.ebuild
+++ /dev/null
@@ -1,150 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit toolchain-glibc
-
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-RESTRICT="strip" # strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-RELEASE_VER=""
-case ${PV} in
-9999*)
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
-	;;
-*)
-	RELEASE_VER=${PV}
-	;;
-esac
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="5"                                  # Gentoo patchset
-: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
-
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2"
-RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	!sys-libs/nss-db"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.7
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.7
-		virtual/os-headers"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI HTTP~tamiko/distfiles/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
-}
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
-
-src_unpack() {
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	toolchain-glibc_src_unpack
-}
-
-src_prepare() {
-	toolchain-glibc_src_prepare
-
-	cd "${S}"
-
-	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-	fi
-
-	case $(gcc-fullversion) in
-	4.8.[0-3]|4.9.0)
-		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
-		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
-		die "need to switch compilers #547420"
-		;;
-	esac
-}

diff --git a/sys-libs/glibc/glibc-2.25-r3.ebuild b/sys-libs/glibc/glibc-2.25-r3.ebuild
deleted file mode 100644
index 3174a4d3611..00000000000
--- a/sys-libs/glibc/glibc-2.25-r3.ebuild
+++ /dev/null
@@ -1,150 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit toolchain-glibc
-
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-RESTRICT="strip" # strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-RELEASE_VER=""
-case ${PV} in
-9999*)
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
-	;;
-*)
-	RELEASE_VER=${PV}
-	;;
-esac
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="7"                                  # Gentoo patchset
-: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
-
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2"
-RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	!sys-libs/nss-db"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.7
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.7
-		virtual/os-headers"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
-}
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
-
-src_unpack() {
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	toolchain-glibc_src_unpack
-}
-
-src_prepare() {
-	toolchain-glibc_src_prepare
-
-	cd "${S}"
-
-	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-	fi
-
-	case $(gcc-fullversion) in
-	4.8.[0-3]|4.9.0)
-		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
-		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
-		die "need to switch compilers #547420"
-		;;
-	esac
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-11 18:32 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-11 18:32 UTC (permalink / raw
  To: gentoo-commits

commit:     d83fdf3eb33a9400f376f930ffa46fde1b321931
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 11 18:29:22 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Sep 11 18:32:22 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d83fdf3e

sys-libs/glibc: Fix the cleanup

This partially reverts commit 78527a00ee720e32ca54a3c15335fe6e41d95e27 and
now deletes the correct files.

 sys-libs/glibc/Manifest                                       | 2 +-
 sys-libs/glibc/{glibc-2.24-r3.ebuild => glibc-2.24-r4.ebuild} | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index b8d66c32d1a..548d8839e5c 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,7 +14,7 @@ DIST glibc-2.22.tar.xz 12969072 SHA256 eb731406903befef1d8f878a46be75ef862b9056a
 DIST glibc-2.23-patches-7.tar.bz2 315221 SHA256 97ef9e370ce9b09d8e9b9f6239f7ef94dd837d29b7bfc1404438c63da1d534ac SHA512 c0d0cab0a370acef0b085b0ab09ce868425a12bbb371d0a9ff91dc83a74a0d8d3b541d10c44650b00b7cb155f8ac1f87764e6a6bd9d6bae8a9a904b4df1650ef WHIRLPOOL 128ea1a2eeaad3d95cdf1054d10232a34e8f88d10ed8907a67d9ff02734243d20b21595ca3698a4861d9c65e2a59aedbcf8e399bd1ed879dba1556ce2995ad9b
 DIST glibc-2.23-patches-8.tar.bz2 304199 SHA256 6110777176abfb8d287d82804d98e007c255db6040a1beca589a212772c90482 SHA512 470814bbbd9d4ee5fa2dd7570a2e14b0229723e373e801472856fd6c2f089499eddc300f69b49af8ba0edbdca583ee3ca521fdb5c642509717cafea0ad925fd2 WHIRLPOOL 1ef9a431d67d7669f34f7db21185d50ddd6dc82c549a9ff274f0b98454417f4098ee771bfe10073be12d3c153ee46ff36e40b46ecb31844ab09791ae29b49074
 DIST glibc-2.23.tar.xz 13455260 SHA256 94efeb00e4603c8546209cefb3e1a50a5315c86fa9b078b6fad758e187ce13e9 SHA512 b82953388cd028e174cb08f082557bbce0dad8b67b17d31b29f90102fd52a51e03d591448ecb64882a1c1d5303afffc7f6ede85cee4c784a9284fbc9b4ad26cf WHIRLPOOL 7c7e3bf55a89a04bac917b9ca5a1cbb1613f22c427d2766f114b5a36f9635856005b823852ef5d3b73462b577fe4e5865e68e7b64633d48a95fa1e5eaa831a71
-DIST glibc-2.24-patches-8.tar.bz2 71769 SHA256 0a21549ed196c5c03efc37273fb991e199c585140d954dca61140c3d0c227af9 SHA512 897c9d158f898edb355ee6478a7e0372a29e6c9d0b98cd80ccaa3ed4f0aab35e3b038217735f2a3b6007ff0cf27c7d6b27a84daaceca9361dce04bc5b2124ada WHIRLPOOL 222b375249c5a3e53fd0116fadf9612c5e5479cd845dc3fcebb496dfe38d70d0e2c84517b79258c73afe2c1f5d15ecec768d33659c10fb15ae59b9061072987d
+DIST glibc-2.24-patches-10.tar.bz2 73586 SHA256 d479033b63ff796fea56fb1bde390c442021acd856994b15c983b4a89e46fbbe SHA512 fc9191a85da53a2515bbaab228648936682e04267284049468e0c82284f618ab2907b9247baca701e16edc50640199ff6d8e2a6a93ccbd5a9d3b0eb73cc484ca WHIRLPOOL 7afe94307900a70de2f5e028d8ec9e0f4b06b661ec6493217e51a13d750f891e10b45c0f66d86fa83c16cc3ce539bb257039b33bc3e363469cd03502d956d75e
 DIST glibc-2.24.tar.xz 13554048 SHA256 99d4a3e8efd144d71488e478f62587578c0f4e1fa0b4eed47ee3d4975ebeb5d3 SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb WHIRLPOOL be82b47fc73f7e780e8e73a5f58b313d8e861d5ea8c4320f95ef0d8c1e125ff011d61dcfc0380be0e83868bd8c3299de1ea662da7fc8d709050e89b2c126e3eb
 DIST glibc-2.25-patches-8.tar.bz2 47110 SHA256 1dc41664153369886d240a1851b15bf0c3c3739c8319e6d68cb0c2f85fc98901 SHA512 41d772c47770a63502c863f3c9bb05164e0ceab69fb7b7f355c25685ae4285d73e9ab0e3836162bd11852339055329d0bdc7238f3191fde39a50ce0d9a60454c WHIRLPOOL c6e0443d75e2e4607226caa4df1ce2b10ef21ec2564b447e2a287888d1f593d51f334a6e1ab942f5d1602d02c6fee87ce4ef9a7db3409de6063bc377a470a42d
 DIST glibc-2.25-patches-9.tar.bz2 67901 SHA256 cbd8af837aa0776940fd41e34874e930a7f25d78cdd212e138dd9a85e1349519 SHA512 b4f0be5b20834aff102394df23084cc0adf1ab674e6ce050550f6b6658cf0eab57f7685cac079b1a19388dba927a36b8ca31f58af3dddc559d7230674ffd59b5 WHIRLPOOL 81c18056fe26a79c7a7598da1181ba02e83daf7d9e9883a3c1195804a35fe22a79d7cc4a8411f2f4a4ce6430e506978199f59b61d3ed0a70b4e4f7dd05ecfafe

diff --git a/sys-libs/glibc/glibc-2.24-r3.ebuild b/sys-libs/glibc/glibc-2.24-r4.ebuild
similarity index 97%
rename from sys-libs/glibc/glibc-2.24-r3.ebuild
rename to sys-libs/glibc/glibc-2.24-r4.ebuild
index edaf4e86a0e..29a17f827ae 100644
--- a/sys-libs/glibc/glibc-2.24-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.24-r4.ebuild
@@ -27,7 +27,7 @@ case ${PV} in
 esac
 GCC_BOOTSTRAP_VER="4.7.3-r1"
 # patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="8"                                  # Gentoo patchset
+PATCH_VER="10"                                 # Gentoo patchset
 : ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
 
 IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
@@ -100,7 +100,7 @@ upstream_uris() {
 	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
 }
 gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI HTTP~tamiko/distfiles/URI"
+	local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
 	devspace=${devspace//HTTP/https://dev.gentoo.org/}
 	echo mirror://gentoo/$1 ${devspace//URI/$1}
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-11 18:32 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-11 18:32 UTC (permalink / raw
  To: gentoo-commits

commit:     2417c26f1b631a453b0453f73cc1a5a471feba5f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 11 18:24:48 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Sep 11 18:32:18 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2417c26f

sys-libs/glibc: Add missing systemtap dependency

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/glibc-2.25-r5.ebuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys-libs/glibc/glibc-2.25-r5.ebuild b/sys-libs/glibc/glibc-2.25-r5.ebuild
index 0ce346e5829..9f3cab925f4 100644
--- a/sys-libs/glibc/glibc-2.25-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r5.ebuild
@@ -72,6 +72,7 @@ COMMON_DEPEND="
 	) )
 	suid? ( caps? ( sys-libs/libcap ) )
 	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-12 11:52 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-12 11:52 UTC (permalink / raw
  To: gentoo-commits

commit:     b13c4dec523c52b4cf3e7179c2878ebe6aa64e6c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 12 11:49:08 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Sep 12 11:51:01 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b13c4dec

sys-libs/glibc: Restore keywords in 2.25-r5

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/glibc-2.25-r5.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.25-r5.ebuild b/sys-libs/glibc/glibc-2.25-r5.ebuild
index 9f3cab925f4..24ad65b328f 100644
--- a/sys-libs/glibc/glibc-2.25-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r5.ebuild
@@ -9,8 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-KEYWORDS=""
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-12 19:46 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-12 19:46 UTC (permalink / raw
  To: gentoo-commits

commit:     3794452ff9cd267ed88c6e54dcff2eae7dfb120a
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 12 19:45:05 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Sep 12 19:46:04 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3794452f

sys-libs/glibc: Prefixify nscd init script

Forward port of 69fe1365667ca61225f4265a45a10f0b38c251d4

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/glibc-2.26-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r1.ebuild b/sys-libs/glibc/glibc-2.26-r1.ebuild
index d7692868c3f..ffd880e2b63 100644
--- a/sys-libs/glibc/glibc-2.26-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r1.ebuild
@@ -702,7 +702,7 @@ glibc_do_src_install() {
 	doins "${WORKDIR}"/extra/etc/*.conf
 
 	if use nscd ; then
-		doinitd "${WORKDIR}"/extra/etc/nscd
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
 
 		local nscd_args=(
 			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-14 18:59 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-14 18:59 UTC (permalink / raw
  To: gentoo-commits

commit:     04e124968cd14dceec1142d5d251ba3c944bb6a6
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 14 18:52:24 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Sep 14 18:56:10 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04e12496

sys-libs/glibc: Minor improvements to 2.26-r1; update live ebuild

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/glibc-2.26-r1.ebuild |  12 +-
 sys-libs/glibc/glibc-9999.ebuild    | 719 ++++++++++++++++++++++++++++++++++--
 2 files changed, 682 insertions(+), 49 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r1.ebuild b/sys-libs/glibc/glibc-2.26-r1.ebuild
index ffd880e2b63..d3f64e629f8 100644
--- a/sys-libs/glibc/glibc-2.26-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r1.ebuild
@@ -91,13 +91,13 @@ RDEPEND="${COMMON_DEPEND}
 if [[ ${CATEGORY} == cross-* ]] ; then
 	DEPEND+=" !crosscompile_opts_headers-only? (
 		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.7
+		>=${CATEGORY}/gcc-4.9
 	)"
 	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
 else
 	DEPEND+="
 		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.7
+		>=sys-devel/gcc-4.9
 		virtual/os-headers
 	"
 	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
@@ -266,14 +266,6 @@ src_prepare() {
 				debug/Makefile || die
 		fi
 	fi
-
-	case $(gcc-fullversion) in
-	4.8.[0-3]|4.9.0)
-		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
-		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
-		die "Need to switch compilers #547420"
-		;;
-	esac
 }
 
 glibc_do_configure() {

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 3cea38a2924..1c50413c2cf 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1,36 +1,42 @@
 # Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=5
+EAPI=6
 
-inherit toolchain-glibc
+inherit prefix toolchain-glibc
 
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # strip ourself #46186
+RESTRICT="strip" # Strip ourself #46186
 EMULTILIB_PKG="true"
 
 # Configuration variables
 
 if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
+	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
+	inherit git-r3
 else
 	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	KEYWORDS=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 
 RELEASE_VER=${PV}
 
 GCC_BOOTSTRAP_VER="4.7.3-r1"
-# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="3"                                  # Gentoo patchset
-: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
 
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+# Gentoo patchset
+PATCH_VER="3"
+
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
+
+IUSE="audit caps debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Min kernel version nptl requires
+: ${NPTL_KERN_VER:="2.6.32"}
 
 # Here's how the cross-compile logic breaks down ...
 #  CTARGET - machine that will target the binaries
@@ -58,8 +64,6 @@ is_crosscompile() {
 	[[ ${CHOST} != ${CTARGET} ]]
 }
 
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
 SLOT="2.2"
 
 # General: We need a new-enough binutils/gcc to match upstream baseline.
@@ -71,53 +75,178 @@ COMMON_DEPEND="
 	) )
 	suid? ( caps? ( sys-libs/libcap ) )
 	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
 	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2"
+	!<sys-apps/portage-2.1.2
+"
 RDEPEND="${COMMON_DEPEND}
 	!sys-kernel/ps3-sources
 	sys-apps/gentoo-functions
-	!sys-libs/nss-db"
+	!sys-libs/nss-db
+"
 
 if [[ ${CATEGORY} == cross-* ]] ; then
 	DEPEND+=" !crosscompile_opts_headers-only? (
 		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.7
+		>=${CATEGORY}/gcc-4.9
 	)"
 	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
 else
 	DEPEND+="
 		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.7
-		virtual/os-headers"
+		>=sys-devel/gcc-4.9
+		virtual/os-headers
+	"
 	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
 	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
 fi
 
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~tamiko/distfiles/URI HTTP~dilfridge/distfiles/URI HTTP~slyfox/distfiles/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
+#
+# the phases
+#
+
+pkg_pretend() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ ${ROOT} == "/" ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+		# The high rev # is to allow people to downgrade between -r# versions.
+		# We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine.
+		# Hopefully we never actually use a r# this high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction"
+			die "Aborting to save your system"
+		fi
+
+		if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
+		then
+			eerror "Your patched vendor kernel is broken.  You need to get an"
+			eerror "update from whoever is providing the kernel to you."
+			eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227"
+			eerror "https://bugs.gentoo.org/262698"
+			die "Keeping your system alive, say thank you"
+		fi
+
+		if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
+		then
+			eerror "Your old kernel is broken.  You need to update it to"
+			eerror "a newer version as syscall(<bignum>) will break."
+			eerror "https://bugs.gentoo.org/279260"
+			die "Keeping your system alive, say thank you"
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	use hardened && ! tc-enables-pie && \
+		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
+
+	# Make sure host system is up to date #394453
+	if has_version '<sys-libs/glibc-2.13' && \
+	   [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]]
+	then
+		ebegin "Scanning system for __guard to see if you need to rebuild first ..."
+		local files=$(
+			scanelf -qys__guard -F'#s%F' \
+				"${EROOT}"/*bin/ \
+				"${EROOT}"/lib* \
+				"${EROOT}"/usr/*bin/ \
+				"${EROOT}"/usr/lib* | \
+				egrep -v \
+					-e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \
+					-e "^${EROOT}/sbin/(ldconfig|sln)$"
+		)
+		[[ -z ${files} ]]
+		if ! eend $? ; then
+			eerror "Your system still has old SSP __guard symbols.  You need to"
+			eerror "rebuild all the packages that provide these files first:"
+			eerror "${files}"
+			die "old __guard detected"
+		fi
+	fi
 }
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
 
 src_unpack() {
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+
+	setup_env
+
+	# Check NPTL support _before_ we unpack things to save some time
+	check_nptl_support
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${S}"
+	touch locale/C-translit.h #185476 #218003
 
-	toolchain-glibc_src_unpack
+	cd "${WORKDIR}"
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
+	# pull out all the addons
+	local d
+	for d in extra/*/configure ; do
+		d=${d%/configure}
+		[[ -d ${S}/${d} ]] && die "${d} already exists in \${S}"
+		mv "${d}" "${S}" || die "moving ${d} failed"
+	done
 }
 
 src_prepare() {
-	toolchain-glibc_src_prepare
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER} ..."
+		eapply "${WORKDIR}"/patches/*.patch
+	fi
+
+	if just_headers ; then
+		if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
+			# mips peeps like to screw with us.  if building headers,
+			# we don't have a real compiler, so we can't let them
+			# insert -mabi on us.
+			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
+			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
+		fi
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
 
 	cd "${S}"
 
@@ -137,12 +266,524 @@ src_prepare() {
 				debug/Makefile || die
 		fi
 	fi
+}
+
+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 $1"
+
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS ; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+
+	# The glibc configure script doesn't properly use LDFLAGS all the time.
+	export CC="$(tc-getCC ${CTARGET}) ${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)"
+	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
+
+	echo
+
+	local myconf=()
+
+	# set addons
+	pushd "${S}" > /dev/null
+	local addons=$(echo */configure | sed \
+		-e 's:/configure::g' \
+		-e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
+		-e 's: \+$::' \
+		-e 's! !,!g' \
+		-e 's!^!,!' \
+		-e '/^,\*$/d')
+	[[ -d ports ]] && addons+=",ports"
+	popd > /dev/null
+
+	case ${CTARGET} in
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=all )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	if [[ $1 == "nptl" ]] ; then
+		myconf+=( --enable-kernel=${NPTL_KERN_VER} )
+	else
+		die "invalid pthread option"
+	fi
+	myconf+=( --enable-add-ons="${addons#,}" )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
 
-	case $(gcc-fullversion) in
-	4.8.[0-3]|4.9.0)
-		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
-		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
-		die "need to switch compilers #547420"
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		--sysconfdir="${EPREFIX}/etc"
+		--localstatedir="${EPREFIX}/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(in_iuse systemtap && use_enable systemtap)
+		$(in_iuse nscd && use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="${EPREFIX}/sbin"
+	export libc_cv_slibdir="${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 "$1")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+			mkdir -p sunrpc
+			cp $(which rpcgen) sunrpc/cross-rpcgen || die
+			touch -t 202001010101 sunrpc/cross-rpcgen || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		${EXTRA_ECONF}
+	)
+
+	local addons
+	[[ -d ${S}/ports ]] && addons+=",ports"
+	myconf+=( --enable-add-ons="${addons#,}" )
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	CC="$(tc-getBUILD_CC)" \
+	CFLAGS="-O1 -pipe" \
+	CPPFLAGS="-U_FORTIFY_SOURCE" \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir $1)"
+	emake -j1 check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test nptl
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}$(alt_prefix)" install || die
+
+	# Normally real_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Newer versions get fancy with libm linkage to include vectorized support.
+	# While we don't really need a ldscript here, portage QA checks get upset.
+	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		dosym ../../$(get_libdir)/libm-${upstream_pv}.so $(alt_usrlibdir)/libm-${upstream_pv}.so
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
 		;;
 	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if in_iuse suid && ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		cd "${ED}"$(alt_libdir)/..
+		[[ -e lib ]] || mkdir lib
+		cd "${ED}"$(alt_usrlibdir)/..
+		[[ -e lib ]] || mkdir lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym /usr/$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+	src_strip
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		elog "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ ${ROOT} != "/" ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+	fi
+
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		# if the host locales.gen contains no entries, we'll install everything
+		local locale_list="${EROOT}etc/locale.gen"
+		if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+			ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+			locale_list="${EROOT}usr/share/i18n/SUPPORTED"
+		fi
+		locale-gen -j $(makeopts_jobs) --config "${locale_list}"
+	fi
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-16 15:48 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-16 15:48 UTC (permalink / raw
  To: gentoo-commits

commit:     00475fbe98988f947c901f55185761a8cd950d59
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 16 15:24:47 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Sep 16 15:48:21 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=00475fbe

sys-libs/glibc: Dont install the stub libnsl, since it comes without headers anyway

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/glibc-2.26-r1.ebuild | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.26-r1.ebuild b/sys-libs/glibc/glibc-2.26-r1.ebuild
index d3f64e629f8..ac72e47377a 100644
--- a/sys-libs/glibc/glibc-2.26-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r1.ebuild
@@ -569,6 +569,11 @@ glibc_do_src_install() {
 
 	emake install_root="${D}$(alt_prefix)" install || die
 
+	# This version (2.26) provides some "compatibility libraries" for the NIS/NIS+ support
+	# which come without headers etc. So, for us completely useless. Use
+	# net-libs/libnsl instead.
+	find "${D}" -name "libnsl*" -delete
+
 	# Normally real_pv is ${PV}. Live ebuilds are exception, there we need
 	# to infer upstream version:
 	# '#define VERSION "2.26.90"' -> '2.26.90'


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-16 18:28 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-16 18:28 UTC (permalink / raw
  To: gentoo-commits

commit:     05d20b8b997bfb1188294bbf1b754469041b9db9
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 16 18:26:35 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Sep 16 18:27:46 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=05d20b8b

sys-libs/glibc: Remove only unversioned libnsl binaries

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/glibc-2.26-r1.ebuild | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r1.ebuild b/sys-libs/glibc/glibc-2.26-r1.ebuild
index ac72e47377a..99126e75c9e 100644
--- a/sys-libs/glibc/glibc-2.26-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r1.ebuild
@@ -569,10 +569,10 @@ glibc_do_src_install() {
 
 	emake install_root="${D}$(alt_prefix)" install || die
 
-	# This version (2.26) provides some "compatibility libraries" for the NIS/NIS+ support
-	# which come without headers etc. So, for us completely useless. Use
-	# net-libs/libnsl instead.
-	find "${D}" -name "libnsl*" -delete
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -o -name "libnsl.so" -delete
 
 	# Normally real_pv is ${PV}. Live ebuilds are exception, there we need
 	# to infer upstream version:


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-17  7:51 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-17  7:51 UTC (permalink / raw
  To: gentoo-commits

commit:     a8a2a9e14ce362112ae3527aac3987bd49e4f5de
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 17 07:49:20 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Sep 17 07:50:25 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8a2a9e1

sys-libs/glibc: Now for real?

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/glibc-2.26-r1.ebuild | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r1.ebuild b/sys-libs/glibc/glibc-2.26-r1.ebuild
index 99126e75c9e..1616671eda9 100644
--- a/sys-libs/glibc/glibc-2.26-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r1.ebuild
@@ -572,7 +572,8 @@ glibc_do_src_install() {
 	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
 	# which come without headers etc. Only needed for binary packages since the
 	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -o -name "libnsl.so" -delete
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
 
 	# Normally real_pv is ${PV}. Live ebuilds are exception, there we need
 	# to infer upstream version:


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-18  9:54 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-18  9:54 UTC (permalink / raw
  To: gentoo-commits

commit:     f9cfa5ddfde26bebc80a54198c5607a5a6cc4418
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 18 09:42:02 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Sep 18 09:54:10 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f9cfa5dd

sys-libs/glibc: Update live ebuild

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/glibc-9999.ebuild | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 1c50413c2cf..461d18c9c09 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -569,6 +569,12 @@ glibc_do_src_install() {
 
 	emake install_root="${D}$(alt_prefix)" install || die
 
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
 	# Normally real_pv is ${PV}. Live ebuilds are exception, there we need
 	# to infer upstream version:
 	# '#define VERSION "2.26.90"' -> '2.26.90'


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-18  9:54 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-18  9:54 UTC (permalink / raw
  To: gentoo-commits

commit:     549cec3ba388acb4c0c03980af3bea5506cb8216
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 18 09:43:12 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Sep 18 09:54:14 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=549cec3b

sys-libs/glibc: Remove "old"

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 sys-libs/glibc/glibc-2.26.ebuild | 148 ---------------------------------------
 1 file changed, 148 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26.ebuild b/sys-libs/glibc/glibc-2.26.ebuild
deleted file mode 100644
index f60657d38dc..00000000000
--- a/sys-libs/glibc/glibc-2.26.ebuild
+++ /dev/null
@@ -1,148 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=5
-
-inherit toolchain-glibc
-
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
-else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="0"                                  # Gentoo patchset
-: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
-
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2"
-RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	!sys-libs/nss-db"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.7
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.7
-		virtual/os-headers"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~tamiko/distfiles/URI HTTP~dilfridge/distfiles/URI HTTP~slyfox/distfiles/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
-}
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
-
-src_unpack() {
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	toolchain-glibc_src_unpack
-}
-
-src_prepare() {
-	toolchain-glibc_src_prepare
-
-	cd "${S}"
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-	fi
-
-	case $(gcc-fullversion) in
-	4.8.[0-3]|4.9.0)
-		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
-		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
-		die "need to switch compilers #547420"
-		;;
-	esac
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-09-23 13:05 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-09-23 13:05 UTC (permalink / raw
  To: gentoo-commits

commit:     15c675558c53f5cd5f7f868f5a41f6914e2f4f4c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 23 13:04:35 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Sep 23 13:05:08 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15c67555

sys-libs/glibc: Update patch level. Tests pass now (on ~amd64)!

Closes: https://bugs.gentoo.org/589370
Package-Manager: Portage-2.3.10, Repoman-2.3.3

 sys-libs/glibc/Manifest             | 2 +-
 sys-libs/glibc/glibc-2.26-r1.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 548d8839e5c..5bf5f217d81 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,6 +19,6 @@ DIST glibc-2.24.tar.xz 13554048 SHA256 99d4a3e8efd144d71488e478f62587578c0f4e1fa
 DIST glibc-2.25-patches-8.tar.bz2 47110 SHA256 1dc41664153369886d240a1851b15bf0c3c3739c8319e6d68cb0c2f85fc98901 SHA512 41d772c47770a63502c863f3c9bb05164e0ceab69fb7b7f355c25685ae4285d73e9ab0e3836162bd11852339055329d0bdc7238f3191fde39a50ce0d9a60454c WHIRLPOOL c6e0443d75e2e4607226caa4df1ce2b10ef21ec2564b447e2a287888d1f593d51f334a6e1ab942f5d1602d02c6fee87ce4ef9a7db3409de6063bc377a470a42d
 DIST glibc-2.25-patches-9.tar.bz2 67901 SHA256 cbd8af837aa0776940fd41e34874e930a7f25d78cdd212e138dd9a85e1349519 SHA512 b4f0be5b20834aff102394df23084cc0adf1ab674e6ce050550f6b6658cf0eab57f7685cac079b1a19388dba927a36b8ca31f58af3dddc559d7230674ffd59b5 WHIRLPOOL 81c18056fe26a79c7a7598da1181ba02e83daf7d9e9883a3c1195804a35fe22a79d7cc4a8411f2f4a4ce6430e506978199f59b61d3ed0a70b4e4f7dd05ecfafe
 DIST glibc-2.25.tar.xz 13873900 SHA256 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e WHIRLPOOL dc2fafaa4a0e5581268338453838a03ed0c5e7a2af844e8fb7086ab8d3ae48efbdbe6f25db1d089ae669cd2f8b0412f690d965506753d86f8525da2df59b7953
-DIST glibc-2.26-patches-0.tar.bz2 22289 SHA256 4b59db44f22c415a3c30a543927e69c04d15ef5d9d5f2ce63eba30e0354ebbd1 SHA512 4afb828d2897c68c7a16e42a2c38a872d38c42954a626d0650cc3fface907d28ba4f5b50504aa4e6c465c5b9c37ab0014d2d228b29ac50335aeb85fec713fd78 WHIRLPOOL 6fa2ad2be084e14e4e9105947232a6b5057d23dd0b55b40bd15bb48c84bfb492a22a27d8a3358f6cc1335b7c9652a0be2d7a977eb266dd08d531ecee12449184
+DIST glibc-2.26-patches-1.tar.bz2 26479 SHA256 ce54a83d17dc2d605e69045a9031d31c729e660fa33e740780de2fea1f186115 SHA512 416cd1e2f4a7eaed2c1f5cd2d483a9d695e82e33add42d0f1c854fd69ccb2ce7f99666aee8fb7bc2320d5d3f44780c3d872134f383279ba573325df91f061dbf WHIRLPOOL deb3a5d12510b20f427a4d82a8b5fff4ab4c4932e6096ddd056efe07d1453f5099040db2c9794c3df4fa79516424a28d2c0c2158e3aec6ae6b05b840ee5e156d
 DIST glibc-2.26.tar.xz 14682748 SHA256 e54e0a934cd2bc94429be79da5e9385898d2306b9eaf3c92d5a77af96190f6bd SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0 WHIRLPOOL 9091c3bccc9b590de6b9595aa391ba01091f0c301bd9199d7c48fbeaeeb013ec9c683c68b65b59c5a69e3905b7f842cca1b0a410431967ecb3a1229b8535486f
 DIST glibc-9999-patches-3.tar.bz2 19892 SHA256 97f60ed6debd495610b123d7a27227e75942bea1a0fb1e5f78833a6f3bbe6c64 SHA512 75084b86a83d447d3a4b3959fa2a93d849e304ba9473ebec5570ca4fb5e2f8dfb38548faf3abc9fbd29b529f2c608b52eb2ef2e6e9a2ad5bea9a9298a19ef596 WHIRLPOOL 04a5c30aabf72530fa96fa3a8eadf8207d85d3a2a948ba5f4b72c0deeeae24e7eb71b99875f0e9b1018051fabb4a23630b41873fa4ff0d6ba9778ca6051212bf

diff --git a/sys-libs/glibc/glibc-2.26-r1.ebuild b/sys-libs/glibc/glibc-2.26-r1.ebuild
index 1616671eda9..29d3ad98709 100644
--- a/sys-libs/glibc/glibc-2.26-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r1.ebuild
@@ -28,7 +28,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER="4.7.3-r1"
 
 # Gentoo patchset
-PATCH_VER="0"
+PATCH_VER="1"
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-03 16:19 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-10-03 16:19 UTC (permalink / raw
  To: gentoo-commits

commit:     b7fd0a9875e25e9e0244f847ad3a7fbfcbf3306b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  3 15:07:57 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Oct  3 16:19:35 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b7fd0a98

sys-libs/glibc: Revision bump for a much larger patchset 2

Package-Manager: Portage-2.3.10, Repoman-2.3.3

 sys-libs/glibc/Manifest             |   1 +
 sys-libs/glibc/glibc-2.26-r2.ebuild | 795 ++++++++++++++++++++++++++++++++++++
 2 files changed, 796 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 5bf5f217d81..51023a39b71 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,5 +20,6 @@ DIST glibc-2.25-patches-8.tar.bz2 47110 SHA256 1dc41664153369886d240a1851b15bf0c
 DIST glibc-2.25-patches-9.tar.bz2 67901 SHA256 cbd8af837aa0776940fd41e34874e930a7f25d78cdd212e138dd9a85e1349519 SHA512 b4f0be5b20834aff102394df23084cc0adf1ab674e6ce050550f6b6658cf0eab57f7685cac079b1a19388dba927a36b8ca31f58af3dddc559d7230674ffd59b5 WHIRLPOOL 81c18056fe26a79c7a7598da1181ba02e83daf7d9e9883a3c1195804a35fe22a79d7cc4a8411f2f4a4ce6430e506978199f59b61d3ed0a70b4e4f7dd05ecfafe
 DIST glibc-2.25.tar.xz 13873900 SHA256 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e WHIRLPOOL dc2fafaa4a0e5581268338453838a03ed0c5e7a2af844e8fb7086ab8d3ae48efbdbe6f25db1d089ae669cd2f8b0412f690d965506753d86f8525da2df59b7953
 DIST glibc-2.26-patches-1.tar.bz2 26479 SHA256 ce54a83d17dc2d605e69045a9031d31c729e660fa33e740780de2fea1f186115 SHA512 416cd1e2f4a7eaed2c1f5cd2d483a9d695e82e33add42d0f1c854fd69ccb2ce7f99666aee8fb7bc2320d5d3f44780c3d872134f383279ba573325df91f061dbf WHIRLPOOL deb3a5d12510b20f427a4d82a8b5fff4ab4c4932e6096ddd056efe07d1453f5099040db2c9794c3df4fa79516424a28d2c0c2158e3aec6ae6b05b840ee5e156d
+DIST glibc-2.26-patches-2.tar.bz2 68040 SHA256 c40f03059d389fd8b22b54f83c0a669c44a38ee84cc359cb86d8f6dbdd1b957f SHA512 2b54d6e33b29d5ee5e4d4b64f299bf15e22ece5ce6555dafe43fd97ec8a2d9ef0645075ff24dc593ec6f89e02caf40c25a72af93ecd11113fba77268ccf486e2 WHIRLPOOL 59c54cdd2e3e64091dd206ad6b5ff467eff6c0d7f8ef5ab11504a4e6cfe958f762b9de2fbe8b6004a9e19963520a84a493ccf03908a78ea0a452dbc28e0df1e5
 DIST glibc-2.26.tar.xz 14682748 SHA256 e54e0a934cd2bc94429be79da5e9385898d2306b9eaf3c92d5a77af96190f6bd SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0 WHIRLPOOL 9091c3bccc9b590de6b9595aa391ba01091f0c301bd9199d7c48fbeaeeb013ec9c683c68b65b59c5a69e3905b7f842cca1b0a410431967ecb3a1229b8535486f
 DIST glibc-9999-patches-3.tar.bz2 19892 SHA256 97f60ed6debd495610b123d7a27227e75942bea1a0fb1e5f78833a6f3bbe6c64 SHA512 75084b86a83d447d3a4b3959fa2a93d849e304ba9473ebec5570ca4fb5e2f8dfb38548faf3abc9fbd29b529f2c608b52eb2ef2e6e9a2ad5bea9a9298a19ef596 WHIRLPOOL 04a5c30aabf72530fa96fa3a8eadf8207d85d3a2a948ba5f4b72c0deeeae24e7eb71b99875f0e9b1018051fabb4a23630b41873fa4ff0d6ba9778ca6051212bf

diff --git a/sys-libs/glibc/glibc-2.26-r2.ebuild b/sys-libs/glibc/glibc-2.26-r2.ebuild
new file mode 100644
index 00000000000..58fdc14f4ec
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.26-r2.ebuild
@@ -0,0 +1,795 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit prefix toolchain-glibc
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+
+# Gentoo patchset
+PATCH_VER=2
+
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
+
+IUSE="audit caps debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Min kernel version nptl requires
+: ${NPTL_KERN_VER:="2.6.32"}
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+"
+RDEPEND="${COMMON_DEPEND}
+	!sys-kernel/ps3-sources
+	sys-apps/gentoo-functions
+	!sys-libs/nss-db
+"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !crosscompile_opts_headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.9
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.9
+		virtual/os-headers
+	"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# the phases
+#
+
+pkg_pretend() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ ${ROOT} == "/" ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+		# The high rev # is to allow people to downgrade between -r# versions.
+		# We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine.
+		# Hopefully we never actually use a r# this high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction"
+			die "Aborting to save your system"
+		fi
+
+		if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
+		then
+			eerror "Your patched vendor kernel is broken.  You need to get an"
+			eerror "update from whoever is providing the kernel to you."
+			eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227"
+			eerror "https://bugs.gentoo.org/262698"
+			die "Keeping your system alive, say thank you"
+		fi
+
+		if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
+		then
+			eerror "Your old kernel is broken.  You need to update it to"
+			eerror "a newer version as syscall(<bignum>) will break."
+			eerror "https://bugs.gentoo.org/279260"
+			die "Keeping your system alive, say thank you"
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	use hardened && ! tc-enables-pie && \
+		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
+
+	# Make sure host system is up to date #394453
+	if has_version '<sys-libs/glibc-2.13' && \
+	   [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]]
+	then
+		ebegin "Scanning system for __guard to see if you need to rebuild first ..."
+		local files=$(
+			scanelf -qys__guard -F'#s%F' \
+				"${EROOT}"/*bin/ \
+				"${EROOT}"/lib* \
+				"${EROOT}"/usr/*bin/ \
+				"${EROOT}"/usr/lib* | \
+				egrep -v \
+					-e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \
+					-e "^${EROOT}/sbin/(ldconfig|sln)$"
+		)
+		[[ -z ${files} ]]
+		if ! eend $? ; then
+			eerror "Your system still has old SSP __guard symbols.  You need to"
+			eerror "rebuild all the packages that provide these files first:"
+			eerror "${files}"
+			die "old __guard detected"
+		fi
+	fi
+}
+
+src_unpack() {
+	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+
+	setup_env
+
+	# Check NPTL support _before_ we unpack things to save some time
+	check_nptl_support
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${S}"
+	touch locale/C-translit.h #185476 #218003
+
+	cd "${WORKDIR}"
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
+	# pull out all the addons
+	local d
+	for d in extra/*/configure ; do
+		d=${d%/configure}
+		[[ -d ${S}/${d} ]] && die "${d} already exists in \${S}"
+		mv "${d}" "${S}" || die "moving ${d} failed"
+	done
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER} ..."
+		eapply "${WORKDIR}"/patches/*.patch
+	fi
+
+	if just_headers ; then
+		if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
+			# mips peeps like to screw with us.  if building headers,
+			# we don't have a real compiler, so we can't let them
+			# insert -mabi on us.
+			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
+			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
+		fi
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+
+	if use hardened ; then
+		# We don't enable these for non-hardened as the output is very terse --
+		# it only states that a crash happened.  The default upstream behavior
+		# includes backtraces and symbols.
+		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
+
+		if use debug ; then
+			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+			sed -i \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				debug/Makefile || die
+		fi
+	fi
+}
+
+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 $1"
+
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS ; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+
+	# The glibc configure script doesn't properly use LDFLAGS all the time.
+	export CC="$(tc-getCC ${CTARGET}) ${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)"
+	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
+
+	echo
+
+	local myconf=()
+
+	# set addons
+	pushd "${S}" > /dev/null
+	local addons=$(echo */configure | sed \
+		-e 's:/configure::g' \
+		-e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
+		-e 's: \+$::' \
+		-e 's! !,!g' \
+		-e 's!^!,!' \
+		-e '/^,\*$/d')
+	[[ -d ports ]] && addons+=",ports"
+	popd > /dev/null
+
+	case ${CTARGET} in
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=all )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	if [[ $1 == "nptl" ]] ; then
+		myconf+=( --enable-kernel=${NPTL_KERN_VER} )
+	else
+		die "invalid pthread option"
+	fi
+	myconf+=( --enable-add-ons="${addons#,}" )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		--sysconfdir="${EPREFIX}/etc"
+		--localstatedir="${EPREFIX}/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(in_iuse systemtap && use_enable systemtap)
+		$(in_iuse nscd && use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="${EPREFIX}/sbin"
+	export libc_cv_slibdir="${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 "$1")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+			mkdir -p sunrpc
+			cp $(which rpcgen) sunrpc/cross-rpcgen || die
+			touch -t 202001010101 sunrpc/cross-rpcgen || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		${EXTRA_ECONF}
+	)
+
+	local addons
+	[[ -d ${S}/ports ]] && addons+=",ports"
+	myconf+=( --enable-add-ons="${addons#,}" )
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	CC="$(tc-getBUILD_CC)" \
+	CFLAGS="-O1 -pipe" \
+	CPPFLAGS="-U_FORTIFY_SOURCE" \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir $1)"
+	emake -j1 check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test nptl
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}$(alt_prefix)" install || die
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally real_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Newer versions get fancy with libm linkage to include vectorized support.
+	# While we don't really need a ldscript here, portage QA checks get upset.
+	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		dosym ../../$(get_libdir)/libm-${upstream_pv}.so $(alt_usrlibdir)/libm-${upstream_pv}.so
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if in_iuse suid && ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		cd "${ED}"$(alt_libdir)/..
+		[[ -e lib ]] || mkdir lib
+		cd "${ED}"$(alt_usrlibdir)/..
+		[[ -e lib ]] || mkdir lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym /usr/$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+	src_strip
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		elog "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ ${ROOT} != "/" ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+	fi
+
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		# if the host locales.gen contains no entries, we'll install everything
+		local locale_list="${EROOT}etc/locale.gen"
+		if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+			ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+			locale_list="${EROOT}usr/share/i18n/SUPPORTED"
+		fi
+		locale-gen -j $(makeopts_jobs) --config "${locale_list}"
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-03 19:41 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-10-03 19:41 UTC (permalink / raw
  To: gentoo-commits

commit:     e5a05d30d2b43abb8be737f7d52911c329204b73
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  3 19:40:06 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Oct  3 19:41:31 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5a05d30

sys-libs/glibc: Rely on PMS, not on bash, for the patch sorting

Package-Manager: Portage-2.3.10, Repoman-2.3.3

 sys-libs/glibc/glibc-2.26-r2.ebuild | 3 ++-
 sys-libs/glibc/glibc-9999.ebuild    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r2.ebuild b/sys-libs/glibc/glibc-2.26-r2.ebuild
index 58fdc14f4ec..f9477803377 100644
--- a/sys-libs/glibc/glibc-2.26-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r2.ebuild
@@ -223,7 +223,8 @@ src_unpack() {
 src_prepare() {
 	if ! use vanilla ; then
 		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER} ..."
-		eapply "${WORKDIR}"/patches/*.patch
+		eapply "${WORKDIR}"/patches
+		elog "Done."
 	fi
 
 	if just_headers ; then

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 461d18c9c09..a31138a4ea8 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -223,7 +223,8 @@ src_unpack() {
 src_prepare() {
 	if ! use vanilla ; then
 		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER} ..."
-		eapply "${WORKDIR}"/patches/*.patch
+		eapply "${WORKDIR}"/patches
+		elog "Done."
 	fi
 
 	if just_headers ; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-05  9:11 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-10-05  9:11 UTC (permalink / raw
  To: gentoo-commits

commit:     df13a79d3c81870a3c37e6e71af246040bf8f01f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  4 22:08:44 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Oct  5 09:11:19 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=df13a79d

sys-libs/glibc: Revision bump to patchlevel 10

Only additional fixes for arm64 and hppa included.

Package-Manager: Portage-2.3.11, Repoman-2.3.3

 sys-libs/glibc/Manifest             |   1 +
 sys-libs/glibc/glibc-2.25-r6.ebuild | 151 ++++++++++++++++++++++++++++++++++++
 2 files changed, 152 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 51023a39b71..e7712fdef39 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,6 +16,7 @@ DIST glibc-2.23-patches-8.tar.bz2 304199 SHA256 6110777176abfb8d287d82804d98e007
 DIST glibc-2.23.tar.xz 13455260 SHA256 94efeb00e4603c8546209cefb3e1a50a5315c86fa9b078b6fad758e187ce13e9 SHA512 b82953388cd028e174cb08f082557bbce0dad8b67b17d31b29f90102fd52a51e03d591448ecb64882a1c1d5303afffc7f6ede85cee4c784a9284fbc9b4ad26cf WHIRLPOOL 7c7e3bf55a89a04bac917b9ca5a1cbb1613f22c427d2766f114b5a36f9635856005b823852ef5d3b73462b577fe4e5865e68e7b64633d48a95fa1e5eaa831a71
 DIST glibc-2.24-patches-10.tar.bz2 73586 SHA256 d479033b63ff796fea56fb1bde390c442021acd856994b15c983b4a89e46fbbe SHA512 fc9191a85da53a2515bbaab228648936682e04267284049468e0c82284f618ab2907b9247baca701e16edc50640199ff6d8e2a6a93ccbd5a9d3b0eb73cc484ca WHIRLPOOL 7afe94307900a70de2f5e028d8ec9e0f4b06b661ec6493217e51a13d750f891e10b45c0f66d86fa83c16cc3ce539bb257039b33bc3e363469cd03502d956d75e
 DIST glibc-2.24.tar.xz 13554048 SHA256 99d4a3e8efd144d71488e478f62587578c0f4e1fa0b4eed47ee3d4975ebeb5d3 SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb WHIRLPOOL be82b47fc73f7e780e8e73a5f58b313d8e861d5ea8c4320f95ef0d8c1e125ff011d61dcfc0380be0e83868bd8c3299de1ea662da7fc8d709050e89b2c126e3eb
+DIST glibc-2.25-patches-10.tar.bz2 63495 SHA256 e406fb1d3aad7996773e5f67dc30ec57cc19bf486c70d9a37d306aaa39c641f7 SHA512 c325bede04eb3a2ec08290a905f8897b19155fc77e709531fb96db0c34e1f93ab12fd72af14ed447bd25e35b8006389324cfad283c7bebe19ffbd4a2ca4b01ff WHIRLPOOL 83ba1afaf8615dc54a4668f388f887ef26bf184b6e55ea13570717a77b7ef2028728f3f6f69775d76e371aa930fd2e44f6fc3602bdbfee6acfc563da8dd4bc06
 DIST glibc-2.25-patches-8.tar.bz2 47110 SHA256 1dc41664153369886d240a1851b15bf0c3c3739c8319e6d68cb0c2f85fc98901 SHA512 41d772c47770a63502c863f3c9bb05164e0ceab69fb7b7f355c25685ae4285d73e9ab0e3836162bd11852339055329d0bdc7238f3191fde39a50ce0d9a60454c WHIRLPOOL c6e0443d75e2e4607226caa4df1ce2b10ef21ec2564b447e2a287888d1f593d51f334a6e1ab942f5d1602d02c6fee87ce4ef9a7db3409de6063bc377a470a42d
 DIST glibc-2.25-patches-9.tar.bz2 67901 SHA256 cbd8af837aa0776940fd41e34874e930a7f25d78cdd212e138dd9a85e1349519 SHA512 b4f0be5b20834aff102394df23084cc0adf1ab674e6ce050550f6b6658cf0eab57f7685cac079b1a19388dba927a36b8ca31f58af3dddc559d7230674ffd59b5 WHIRLPOOL 81c18056fe26a79c7a7598da1181ba02e83daf7d9e9883a3c1195804a35fe22a79d7cc4a8411f2f4a4ce6430e506978199f59b61d3ed0a70b4e4f7dd05ecfafe
 DIST glibc-2.25.tar.xz 13873900 SHA256 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e WHIRLPOOL dc2fafaa4a0e5581268338453838a03ed0c5e7a2af844e8fb7086ab8d3ae48efbdbe6f25db1d089ae669cd2f8b0412f690d965506753d86f8525da2df59b7953

diff --git a/sys-libs/glibc/glibc-2.25-r6.ebuild b/sys-libs/glibc/glibc-2.25-r6.ebuild
new file mode 100644
index 00000000000..cc567c01d31
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.25-r6.ebuild
@@ -0,0 +1,151 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit toolchain-glibc
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+case ${PV} in
+9999*)
+	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+	EGIT_SOURCEDIRS="${S}"
+	inherit git-2
+	;;
+*)
+	RELEASE_VER=${PV}
+	;;
+esac
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
+PATCH_VER="10"                                  # Gentoo patchset
+: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
+
+IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2"
+RDEPEND="${COMMON_DEPEND}
+	!sys-kernel/ps3-sources
+	sys-apps/gentoo-functions
+	!sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !crosscompile_opts_headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.7
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.7
+		virtual/os-headers"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+	local devspace="HTTP~vapier/dist/URI HTTP~dilfridge/distfiles/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
+	devspace=${devspace//HTTP/https://dev.gentoo.org/}
+	echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+src_unpack() {
+	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+
+	toolchain-glibc_src_unpack
+}
+
+src_prepare() {
+	toolchain-glibc_src_prepare
+
+	cd "${S}"
+
+	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
+
+	if use hardened ; then
+		# We don't enable these for non-hardened as the output is very terse --
+		# it only states that a crash happened.  The default upstream behavior
+		# includes backtraces and symbols.
+		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
+
+		if use debug ; then
+			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+			sed -i \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				debug/Makefile || die
+		fi
+	fi
+
+	case $(gcc-fullversion) in
+	4.8.[0-3]|4.9.0)
+		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
+		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
+		die "need to switch compilers #547420"
+		;;
+	esac
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-05 16:43 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-10-05 16:43 UTC (permalink / raw
  To: gentoo-commits

commit:     101242c5ebd50355abfc06fd6f2c342452dcff0a
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Oct  5 13:11:15 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Oct  5 16:42:49 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=101242c5

sys-libs/glibc: Another revbump, patchset 11. Bug 632556, sorry about that.

Package-Manager: Portage-2.3.11, Repoman-2.3.3

 sys-libs/glibc/Manifest                                       | 2 +-
 sys-libs/glibc/{glibc-2.25-r6.ebuild => glibc-2.25-r7.ebuild} | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index e7712fdef39..f5e38565b6a 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,7 +16,7 @@ DIST glibc-2.23-patches-8.tar.bz2 304199 SHA256 6110777176abfb8d287d82804d98e007
 DIST glibc-2.23.tar.xz 13455260 SHA256 94efeb00e4603c8546209cefb3e1a50a5315c86fa9b078b6fad758e187ce13e9 SHA512 b82953388cd028e174cb08f082557bbce0dad8b67b17d31b29f90102fd52a51e03d591448ecb64882a1c1d5303afffc7f6ede85cee4c784a9284fbc9b4ad26cf WHIRLPOOL 7c7e3bf55a89a04bac917b9ca5a1cbb1613f22c427d2766f114b5a36f9635856005b823852ef5d3b73462b577fe4e5865e68e7b64633d48a95fa1e5eaa831a71
 DIST glibc-2.24-patches-10.tar.bz2 73586 SHA256 d479033b63ff796fea56fb1bde390c442021acd856994b15c983b4a89e46fbbe SHA512 fc9191a85da53a2515bbaab228648936682e04267284049468e0c82284f618ab2907b9247baca701e16edc50640199ff6d8e2a6a93ccbd5a9d3b0eb73cc484ca WHIRLPOOL 7afe94307900a70de2f5e028d8ec9e0f4b06b661ec6493217e51a13d750f891e10b45c0f66d86fa83c16cc3ce539bb257039b33bc3e363469cd03502d956d75e
 DIST glibc-2.24.tar.xz 13554048 SHA256 99d4a3e8efd144d71488e478f62587578c0f4e1fa0b4eed47ee3d4975ebeb5d3 SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb WHIRLPOOL be82b47fc73f7e780e8e73a5f58b313d8e861d5ea8c4320f95ef0d8c1e125ff011d61dcfc0380be0e83868bd8c3299de1ea662da7fc8d709050e89b2c126e3eb
-DIST glibc-2.25-patches-10.tar.bz2 63495 SHA256 e406fb1d3aad7996773e5f67dc30ec57cc19bf486c70d9a37d306aaa39c641f7 SHA512 c325bede04eb3a2ec08290a905f8897b19155fc77e709531fb96db0c34e1f93ab12fd72af14ed447bd25e35b8006389324cfad283c7bebe19ffbd4a2ca4b01ff WHIRLPOOL 83ba1afaf8615dc54a4668f388f887ef26bf184b6e55ea13570717a77b7ef2028728f3f6f69775d76e371aa930fd2e44f6fc3602bdbfee6acfc563da8dd4bc06
+DIST glibc-2.25-patches-11.tar.bz2 64221 SHA256 38c76c844238a7bbaecc85b359e67af6a98a1614f3196f25d85f83dec4358e99 SHA512 cbbbca9653f55f0cb3b73c38c979cb439c87b172819f3e999d2b435d59cd2bef2c89f11a398300c53f447ad433ee87f47a0f3e890c78f8694705c788455325dd WHIRLPOOL e61203ac129d7283f3beda1421e1365da58c229bcb6b6a1f8b71755d9ea0e2bfb64b8be69ab7698861a593d4b98ab6163d574f3c215fba0a0d9e6a1b15d2eed5
 DIST glibc-2.25-patches-8.tar.bz2 47110 SHA256 1dc41664153369886d240a1851b15bf0c3c3739c8319e6d68cb0c2f85fc98901 SHA512 41d772c47770a63502c863f3c9bb05164e0ceab69fb7b7f355c25685ae4285d73e9ab0e3836162bd11852339055329d0bdc7238f3191fde39a50ce0d9a60454c WHIRLPOOL c6e0443d75e2e4607226caa4df1ce2b10ef21ec2564b447e2a287888d1f593d51f334a6e1ab942f5d1602d02c6fee87ce4ef9a7db3409de6063bc377a470a42d
 DIST glibc-2.25-patches-9.tar.bz2 67901 SHA256 cbd8af837aa0776940fd41e34874e930a7f25d78cdd212e138dd9a85e1349519 SHA512 b4f0be5b20834aff102394df23084cc0adf1ab674e6ce050550f6b6658cf0eab57f7685cac079b1a19388dba927a36b8ca31f58af3dddc559d7230674ffd59b5 WHIRLPOOL 81c18056fe26a79c7a7598da1181ba02e83daf7d9e9883a3c1195804a35fe22a79d7cc4a8411f2f4a4ce6430e506978199f59b61d3ed0a70b4e4f7dd05ecfafe
 DIST glibc-2.25.tar.xz 13873900 SHA256 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e WHIRLPOOL dc2fafaa4a0e5581268338453838a03ed0c5e7a2af844e8fb7086ab8d3ae48efbdbe6f25db1d089ae669cd2f8b0412f690d965506753d86f8525da2df59b7953

diff --git a/sys-libs/glibc/glibc-2.25-r6.ebuild b/sys-libs/glibc/glibc-2.25-r7.ebuild
similarity index 98%
rename from sys-libs/glibc/glibc-2.25-r6.ebuild
rename to sys-libs/glibc/glibc-2.25-r7.ebuild
index cc567c01d31..18cab6ab379 100644
--- a/sys-libs/glibc/glibc-2.25-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r7.ebuild
@@ -27,7 +27,7 @@ case ${PV} in
 esac
 GCC_BOOTSTRAP_VER="4.7.3-r1"
 # patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="10"                                  # Gentoo patchset
+PATCH_VER="11"                                  # Gentoo patchset
 : ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
 
 IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-07 22:26 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-10-07 22:26 UTC (permalink / raw
  To: gentoo-commits

commit:     675ec97166ec4381c85c5af34b2b71f31f235e86
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  7 22:25:32 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct  7 22:25:58 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=675ec971

sys-libs/glibc: Replace the last absolute symlink with a relative one

Package-Manager: Portage-2.3.11, Repoman-2.3.2

 sys-libs/glibc/glibc-2.26-r2.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r2.ebuild b/sys-libs/glibc/glibc-2.26-r2.ebuild
index f9477803377..8b6e1b1520b 100644
--- a/sys-libs/glibc/glibc-2.26-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r2.ebuild
@@ -689,7 +689,7 @@ glibc_do_src_install() {
 	keepdir /usr/$(get_libdir)/locale
 	for a in $(get_install_abis) ; do
 		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym /usr/$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
 		fi
 	done
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a31138a4ea8..dacec0b7e24 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -689,7 +689,7 @@ glibc_do_src_install() {
 	keepdir /usr/$(get_libdir)/locale
 	for a in $(get_install_abis) ; do
 		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym /usr/$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
 		fi
 	done
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-14 21:11 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-10-14 21:11 UTC (permalink / raw
  To: gentoo-commits

commit:     199b5b1ddb668f9adc2777f31c417013f63a32cd
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 14 21:10:20 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 14 21:10:55 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=199b5b1d

sys-libs/glibc: Various updates to live ebuild

* Remove references to add-on mechanism (removed upstream)
* Fix install phase with new ChangeLog.old directory
* Use https:// git clone URI
* Minor simplifications
* Some annotations about possible improvements

Package-Manager: Portage-2.3.11, Repoman-2.3.3

 sys-libs/glibc/glibc-9999.ebuild | 58 ++++++++++++++++------------------------
 1 file changed, 23 insertions(+), 35 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index dacec0b7e24..f8e270e663f 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -15,7 +15,7 @@ EMULTILIB_PKG="true"
 # Configuration variables
 
 if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
 	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
@@ -64,6 +64,10 @@ is_crosscompile() {
 	[[ ${CHOST} != ${CTARGET} ]]
 }
 
+just_headers() {
+	is_crosscompile && use crosscompile_opts_headers-only
+}
+
 SLOT="2.2"
 
 # General: We need a new-enough binutils/gcc to match upstream baseline.
@@ -108,6 +112,8 @@ fi
 # the phases
 #
 
+# pkg_pretend
+
 pkg_pretend() {
 	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
 	check_devpts
@@ -191,6 +197,10 @@ pkg_pretend() {
 		fi
 	fi
 }
+# todo: shouldn't most of these checks be called also in src_configure again?
+# (since consistency is not guaranteed between pkg_ and src_)
+
+# src_unpack
 
 src_unpack() {
 	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
@@ -199,6 +209,7 @@ src_unpack() {
 
 	# Check NPTL support _before_ we unpack things to save some time
 	check_nptl_support
+	# todo: 1) move this to pkg_pretend? 2) use proper functions for kv
 
 	if [[ -n ${EGIT_REPO_URI} ]] ; then
 		git-r3_src_unpack
@@ -211,13 +222,6 @@ src_unpack() {
 
 	cd "${WORKDIR}"
 	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
-	# pull out all the addons
-	local d
-	for d in extra/*/configure ; do
-		d=${d%/configure}
-		[[ -d ${S}/${d} ]] && die "${d} already exists in \${S}"
-		mv "${d}" "${S}" || die "moving ${d} failed"
-	done
 }
 
 src_prepare() {
@@ -277,7 +281,7 @@ glibc_do_configure() {
 	# we accumulate crap across abis
 	unset CXX
 
-	einfo "Configuring glibc for $1"
+	einfo "Configuring glibc for nptl"
 
 	local v
 	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS ; do
@@ -296,18 +300,6 @@ glibc_do_configure() {
 
 	local myconf=()
 
-	# set addons
-	pushd "${S}" > /dev/null
-	local addons=$(echo */configure | sed \
-		-e 's:/configure::g' \
-		-e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
-		-e 's: \+$::' \
-		-e 's! !,!g' \
-		-e 's!^!,!' \
-		-e '/^,\*$/d')
-	[[ -d ports ]] && addons+=",ports"
-	popd > /dev/null
-
 	case ${CTARGET} in
 		powerpc-*)
 			# Currently gcc on powerpc32 generates invalid code for
@@ -325,12 +317,7 @@ glibc_do_configure() {
 
 	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
 
-	if [[ $1 == "nptl" ]] ; then
-		myconf+=( --enable-kernel=${NPTL_KERN_VER} )
-	else
-		die "invalid pthread option"
-	fi
-	myconf+=( --enable-add-ons="${addons#,}" )
+	myconf+=( --enable-kernel=${NPTL_KERN_VER} )
 
 	# Since SELinux support is only required for nscd, only enable it if:
 	# 1. USE selinux
@@ -399,7 +386,7 @@ glibc_do_configure() {
 	# this overriding check.  #347761
 	export libc_cv_hashstyle=no
 
-	local builddir=$(builddir "$1")
+	local builddir=$(builddir nptl)
 	mkdir -p "${builddir}"
 	cd "${builddir}"
 	set -- "${S}"/configure "${myconf[@]}"
@@ -420,6 +407,10 @@ glibc_do_configure() {
 	# to lie and use a local copy of gcc.  Like if the system
 	# is built with MULTILIB_ABIS="amd64 x86" but we want to
 	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	# This reqires net-libs/rpcsvc-proto now (which provides
+	# rpcgen) !!! Needs analysis how to best add to deps.
+	#
 	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
 		echo 'main(){}' > "${T}"/test.c
 		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
@@ -504,10 +495,6 @@ glibc_headers_configure() {
 		${EXTRA_ECONF}
 	)
 
-	local addons
-	[[ -d ${S}/ports ]] && addons+=",ports"
-	myconf+=( --enable-add-ons="${addons#,}" )
-
 	# Nothing is compiled here which would affect the headers for the target.
 	# So forcing CC/CFLAGS is sane.
 	set -- "${S}"/configure "${myconf[@]}"
@@ -544,14 +531,14 @@ src_compile() {
 }
 
 glibc_src_test() {
-	cd "$(builddir $1)"
+	cd "$(builddir nptl)"
 	emake -j1 check
 }
 
 do_src_test() {
 	local ret=0
 
-	glibc_src_test nptl
+	glibc_src_test
 	: $(( ret |= $? ))
 
 	return ${ret}
@@ -719,9 +706,10 @@ glibc_do_src_install() {
 	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
 	doenvd "${T}"/00glibc
 
-	for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
 		[[ -s ${d} ]] && dodoc ${d}
 	done
+	dodoc -r ChangeLog.old
 
 	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
 	# creation of the "factory" symlink in pkg_postinst().


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-21 12:47 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-10-21 12:47 UTC (permalink / raw
  To: gentoo-commits

commit:     7d9ba5d62a1dc1d8447b4b92f752c9162b9c9f8c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 21 12:47:21 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 21 12:47:39 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7d9ba5d6

sys-libs/glibc: Revision bump that re-adds the <sys/sysmacros.h> include, bug 575232

We keep the patch in future versions though, pending some information from glibc upstream.

Bug: https://bugs.gentoo.org/575232
Package-Manager: Portage-2.3.12, Repoman-2.3.3

 sys-libs/glibc/glibc-2.25-r8.ebuild | 153 ++++++++++++++++++++++++++++++++++++
 1 file changed, 153 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.25-r8.ebuild b/sys-libs/glibc/glibc-2.25-r8.ebuild
new file mode 100644
index 00000000000..5b91bc5255a
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.25-r8.ebuild
@@ -0,0 +1,153 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit toolchain-glibc
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+case ${PV} in
+9999*)
+	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+	EGIT_SOURCEDIRS="${S}"
+	inherit git-2
+	;;
+*)
+	RELEASE_VER=${PV}
+	;;
+esac
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
+PATCH_VER="11"                                  # Gentoo patchset
+: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
+
+GLIBC_PATCH_EXCLUDE+=" 0005_all_sys-types.h-drop-sys-sysmacros.h-include.patch"
+
+IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2"
+RDEPEND="${COMMON_DEPEND}
+	!sys-kernel/ps3-sources
+	sys-apps/gentoo-functions
+	!sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !crosscompile_opts_headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.7
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.7
+		virtual/os-headers"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+	local devspace="HTTP~vapier/dist/URI HTTP~dilfridge/distfiles/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
+	devspace=${devspace//HTTP/https://dev.gentoo.org/}
+	echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+src_unpack() {
+	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+
+	toolchain-glibc_src_unpack
+}
+
+src_prepare() {
+	toolchain-glibc_src_prepare
+
+	cd "${S}"
+
+	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
+
+	if use hardened ; then
+		# We don't enable these for non-hardened as the output is very terse --
+		# it only states that a crash happened.  The default upstream behavior
+		# includes backtraces and symbols.
+		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
+
+		if use debug ; then
+			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+			sed -i \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				debug/Makefile || die
+		fi
+	fi
+
+	case $(gcc-fullversion) in
+	4.8.[0-3]|4.9.0)
+		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
+		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
+		die "need to switch compilers #547420"
+		;;
+	esac
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-22 12:25 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-10-22 12:25 UTC (permalink / raw
  To: gentoo-commits

commit:     dd0abd989b7d8d8b3926b6f384a66962fdae722e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 22 12:25:04 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct 22 12:25:04 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd0abd98

sys-libs/glibc: Restore keywords

Package-Manager: Portage-2.3.12, Repoman-2.3.3

 sys-libs/glibc/glibc-2.25-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r8.ebuild b/sys-libs/glibc/glibc-2.25-r8.ebuild
index 5b91bc5255a..38b69a7237a 100644
--- a/sys-libs/glibc/glibc-2.25-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r8.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-22 19:46 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-10-22 19:46 UTC (permalink / raw
  To: gentoo-commits

commit:     4c0ab174902048d0332c99c880a6475328b4a410
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 22 12:35:25 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct 22 19:46:18 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4c0ab174

sys-libs/glibc: Remove old revisions

Package-Manager: Portage-2.3.12, Repoman-2.3.3

 sys-libs/glibc/Manifest             |   3 -
 sys-libs/glibc/glibc-2.25-r4.ebuild | 150 -------
 sys-libs/glibc/glibc-2.25-r5.ebuild | 151 -------
 sys-libs/glibc/glibc-2.25-r7.ebuild | 151 -------
 sys-libs/glibc/glibc-2.26-r1.ebuild | 795 ------------------------------------
 5 files changed, 1250 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index f5e38565b6a..88147f03cd5 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,10 +17,7 @@ DIST glibc-2.23.tar.xz 13455260 SHA256 94efeb00e4603c8546209cefb3e1a50a5315c86fa
 DIST glibc-2.24-patches-10.tar.bz2 73586 SHA256 d479033b63ff796fea56fb1bde390c442021acd856994b15c983b4a89e46fbbe SHA512 fc9191a85da53a2515bbaab228648936682e04267284049468e0c82284f618ab2907b9247baca701e16edc50640199ff6d8e2a6a93ccbd5a9d3b0eb73cc484ca WHIRLPOOL 7afe94307900a70de2f5e028d8ec9e0f4b06b661ec6493217e51a13d750f891e10b45c0f66d86fa83c16cc3ce539bb257039b33bc3e363469cd03502d956d75e
 DIST glibc-2.24.tar.xz 13554048 SHA256 99d4a3e8efd144d71488e478f62587578c0f4e1fa0b4eed47ee3d4975ebeb5d3 SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb WHIRLPOOL be82b47fc73f7e780e8e73a5f58b313d8e861d5ea8c4320f95ef0d8c1e125ff011d61dcfc0380be0e83868bd8c3299de1ea662da7fc8d709050e89b2c126e3eb
 DIST glibc-2.25-patches-11.tar.bz2 64221 SHA256 38c76c844238a7bbaecc85b359e67af6a98a1614f3196f25d85f83dec4358e99 SHA512 cbbbca9653f55f0cb3b73c38c979cb439c87b172819f3e999d2b435d59cd2bef2c89f11a398300c53f447ad433ee87f47a0f3e890c78f8694705c788455325dd WHIRLPOOL e61203ac129d7283f3beda1421e1365da58c229bcb6b6a1f8b71755d9ea0e2bfb64b8be69ab7698861a593d4b98ab6163d574f3c215fba0a0d9e6a1b15d2eed5
-DIST glibc-2.25-patches-8.tar.bz2 47110 SHA256 1dc41664153369886d240a1851b15bf0c3c3739c8319e6d68cb0c2f85fc98901 SHA512 41d772c47770a63502c863f3c9bb05164e0ceab69fb7b7f355c25685ae4285d73e9ab0e3836162bd11852339055329d0bdc7238f3191fde39a50ce0d9a60454c WHIRLPOOL c6e0443d75e2e4607226caa4df1ce2b10ef21ec2564b447e2a287888d1f593d51f334a6e1ab942f5d1602d02c6fee87ce4ef9a7db3409de6063bc377a470a42d
-DIST glibc-2.25-patches-9.tar.bz2 67901 SHA256 cbd8af837aa0776940fd41e34874e930a7f25d78cdd212e138dd9a85e1349519 SHA512 b4f0be5b20834aff102394df23084cc0adf1ab674e6ce050550f6b6658cf0eab57f7685cac079b1a19388dba927a36b8ca31f58af3dddc559d7230674ffd59b5 WHIRLPOOL 81c18056fe26a79c7a7598da1181ba02e83daf7d9e9883a3c1195804a35fe22a79d7cc4a8411f2f4a4ce6430e506978199f59b61d3ed0a70b4e4f7dd05ecfafe
 DIST glibc-2.25.tar.xz 13873900 SHA256 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e WHIRLPOOL dc2fafaa4a0e5581268338453838a03ed0c5e7a2af844e8fb7086ab8d3ae48efbdbe6f25db1d089ae669cd2f8b0412f690d965506753d86f8525da2df59b7953
-DIST glibc-2.26-patches-1.tar.bz2 26479 SHA256 ce54a83d17dc2d605e69045a9031d31c729e660fa33e740780de2fea1f186115 SHA512 416cd1e2f4a7eaed2c1f5cd2d483a9d695e82e33add42d0f1c854fd69ccb2ce7f99666aee8fb7bc2320d5d3f44780c3d872134f383279ba573325df91f061dbf WHIRLPOOL deb3a5d12510b20f427a4d82a8b5fff4ab4c4932e6096ddd056efe07d1453f5099040db2c9794c3df4fa79516424a28d2c0c2158e3aec6ae6b05b840ee5e156d
 DIST glibc-2.26-patches-2.tar.bz2 68040 SHA256 c40f03059d389fd8b22b54f83c0a669c44a38ee84cc359cb86d8f6dbdd1b957f SHA512 2b54d6e33b29d5ee5e4d4b64f299bf15e22ece5ce6555dafe43fd97ec8a2d9ef0645075ff24dc593ec6f89e02caf40c25a72af93ecd11113fba77268ccf486e2 WHIRLPOOL 59c54cdd2e3e64091dd206ad6b5ff467eff6c0d7f8ef5ab11504a4e6cfe958f762b9de2fbe8b6004a9e19963520a84a493ccf03908a78ea0a452dbc28e0df1e5
 DIST glibc-2.26.tar.xz 14682748 SHA256 e54e0a934cd2bc94429be79da5e9385898d2306b9eaf3c92d5a77af96190f6bd SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0 WHIRLPOOL 9091c3bccc9b590de6b9595aa391ba01091f0c301bd9199d7c48fbeaeeb013ec9c683c68b65b59c5a69e3905b7f842cca1b0a410431967ecb3a1229b8535486f
 DIST glibc-9999-patches-3.tar.bz2 19892 SHA256 97f60ed6debd495610b123d7a27227e75942bea1a0fb1e5f78833a6f3bbe6c64 SHA512 75084b86a83d447d3a4b3959fa2a93d849e304ba9473ebec5570ca4fb5e2f8dfb38548faf3abc9fbd29b529f2c608b52eb2ef2e6e9a2ad5bea9a9298a19ef596 WHIRLPOOL 04a5c30aabf72530fa96fa3a8eadf8207d85d3a2a948ba5f4b72c0deeeae24e7eb71b99875f0e9b1018051fabb4a23630b41873fa4ff0d6ba9778ca6051212bf

diff --git a/sys-libs/glibc/glibc-2.25-r4.ebuild b/sys-libs/glibc/glibc-2.25-r4.ebuild
deleted file mode 100644
index 27cd42605ff..00000000000
--- a/sys-libs/glibc/glibc-2.25-r4.ebuild
+++ /dev/null
@@ -1,150 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit toolchain-glibc
-
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-RESTRICT="strip" # strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-RELEASE_VER=""
-case ${PV} in
-9999*)
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
-	;;
-*)
-	RELEASE_VER=${PV}
-	;;
-esac
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="8"                                  # Gentoo patchset
-: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
-
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2"
-RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	!sys-libs/nss-db"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.7
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.7
-		virtual/os-headers"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
-}
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
-
-src_unpack() {
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	toolchain-glibc_src_unpack
-}
-
-src_prepare() {
-	toolchain-glibc_src_prepare
-
-	cd "${S}"
-
-	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-	fi
-
-	case $(gcc-fullversion) in
-	4.8.[0-3]|4.9.0)
-		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
-		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
-		die "need to switch compilers #547420"
-		;;
-	esac
-}

diff --git a/sys-libs/glibc/glibc-2.25-r5.ebuild b/sys-libs/glibc/glibc-2.25-r5.ebuild
deleted file mode 100644
index 24ad65b328f..00000000000
--- a/sys-libs/glibc/glibc-2.25-r5.ebuild
+++ /dev/null
@@ -1,151 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit toolchain-glibc
-
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-RESTRICT="strip" # strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-RELEASE_VER=""
-case ${PV} in
-9999*)
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
-	;;
-*)
-	RELEASE_VER=${PV}
-	;;
-esac
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="9"                                  # Gentoo patchset
-: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
-
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2"
-RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	!sys-libs/nss-db"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.7
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.7
-		virtual/os-headers"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~dilfridge/distfiles/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
-}
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
-
-src_unpack() {
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	toolchain-glibc_src_unpack
-}
-
-src_prepare() {
-	toolchain-glibc_src_prepare
-
-	cd "${S}"
-
-	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-	fi
-
-	case $(gcc-fullversion) in
-	4.8.[0-3]|4.9.0)
-		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
-		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
-		die "need to switch compilers #547420"
-		;;
-	esac
-}

diff --git a/sys-libs/glibc/glibc-2.25-r7.ebuild b/sys-libs/glibc/glibc-2.25-r7.ebuild
deleted file mode 100644
index 18cab6ab379..00000000000
--- a/sys-libs/glibc/glibc-2.25-r7.ebuild
+++ /dev/null
@@ -1,151 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit toolchain-glibc
-
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-RESTRICT="strip" # strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-RELEASE_VER=""
-case ${PV} in
-9999*)
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
-	;;
-*)
-	RELEASE_VER=${PV}
-	;;
-esac
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="11"                                  # Gentoo patchset
-: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
-
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2"
-RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	!sys-libs/nss-db"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.7
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.7
-		virtual/os-headers"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~dilfridge/distfiles/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
-}
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
-
-src_unpack() {
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	toolchain-glibc_src_unpack
-}
-
-src_prepare() {
-	toolchain-glibc_src_prepare
-
-	cd "${S}"
-
-	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-	fi
-
-	case $(gcc-fullversion) in
-	4.8.[0-3]|4.9.0)
-		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
-		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
-		die "need to switch compilers #547420"
-		;;
-	esac
-}

diff --git a/sys-libs/glibc/glibc-2.26-r1.ebuild b/sys-libs/glibc/glibc-2.26-r1.ebuild
deleted file mode 100644
index 29d3ad98709..00000000000
--- a/sys-libs/glibc/glibc-2.26-r1.ebuild
+++ /dev/null
@@ -1,795 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix toolchain-glibc
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-
-# Gentoo patchset
-PATCH_VER="1"
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
-
-IUSE="audit caps debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
-
-# Min kernel version nptl requires
-: ${NPTL_KERN_VER:="2.6.32"}
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-"
-RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.9
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.9
-		virtual/os-headers
-	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# the phases
-#
-
-pkg_pretend() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-		# The high rev # is to allow people to downgrade between -r# versions.
-		# We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine.
-		# Hopefully we never actually use a r# this high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction"
-			die "Aborting to save your system"
-		fi
-
-		if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
-		then
-			eerror "Your patched vendor kernel is broken.  You need to get an"
-			eerror "update from whoever is providing the kernel to you."
-			eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227"
-			eerror "https://bugs.gentoo.org/262698"
-			die "Keeping your system alive, say thank you"
-		fi
-
-		if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
-		then
-			eerror "Your old kernel is broken.  You need to update it to"
-			eerror "a newer version as syscall(<bignum>) will break."
-			eerror "https://bugs.gentoo.org/279260"
-			die "Keeping your system alive, say thank you"
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	use hardened && ! tc-enables-pie && \
-		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
-
-	# Make sure host system is up to date #394453
-	if has_version '<sys-libs/glibc-2.13' && \
-	   [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]]
-	then
-		ebegin "Scanning system for __guard to see if you need to rebuild first ..."
-		local files=$(
-			scanelf -qys__guard -F'#s%F' \
-				"${EROOT}"/*bin/ \
-				"${EROOT}"/lib* \
-				"${EROOT}"/usr/*bin/ \
-				"${EROOT}"/usr/lib* | \
-				egrep -v \
-					-e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \
-					-e "^${EROOT}/sbin/(ldconfig|sln)$"
-		)
-		[[ -z ${files} ]]
-		if ! eend $? ; then
-			eerror "Your system still has old SSP __guard symbols.  You need to"
-			eerror "rebuild all the packages that provide these files first:"
-			eerror "${files}"
-			die "old __guard detected"
-		fi
-	fi
-}
-
-src_unpack() {
-	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	setup_env
-
-	# Check NPTL support _before_ we unpack things to save some time
-	check_nptl_support
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}"
-	touch locale/C-translit.h #185476 #218003
-
-	cd "${WORKDIR}"
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
-	# pull out all the addons
-	local d
-	for d in extra/*/configure ; do
-		d=${d%/configure}
-		[[ -d ${S}/${d} ]] && die "${d} already exists in \${S}"
-		mv "${d}" "${S}" || die "moving ${d} failed"
-	done
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER} ..."
-		eapply "${WORKDIR}"/patches/*.patch
-	fi
-
-	if just_headers ; then
-		if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
-			# mips peeps like to screw with us.  if building headers,
-			# we don't have a real compiler, so we can't let them
-			# insert -mabi on us.
-			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
-			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
-		fi
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-	fi
-}
-
-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 $1"
-
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS ; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-
-	# The glibc configure script doesn't properly use LDFLAGS all the time.
-	export CC="$(tc-getCC ${CTARGET}) ${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)"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	# set addons
-	pushd "${S}" > /dev/null
-	local addons=$(echo */configure | sed \
-		-e 's:/configure::g' \
-		-e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
-		-e 's: \+$::' \
-		-e 's! !,!g' \
-		-e 's!^!,!' \
-		-e '/^,\*$/d')
-	[[ -d ports ]] && addons+=",ports"
-	popd > /dev/null
-
-	case ${CTARGET} in
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=all )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	if [[ $1 == "nptl" ]] ; then
-		myconf+=( --enable-kernel=${NPTL_KERN_VER} )
-	else
-		die "invalid pthread option"
-	fi
-	myconf+=( --enable-add-ons="${addons#,}" )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(in_iuse systemtap && use_enable systemtap)
-		$(in_iuse nscd && use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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 "$1")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-			mkdir -p sunrpc
-			cp $(which rpcgen) sunrpc/cross-rpcgen || die
-			touch -t 202001010101 sunrpc/cross-rpcgen || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	local addons
-	[[ -d ${S}/ports ]] && addons+=",ports"
-	myconf+=( --enable-add-ons="${addons#,}" )
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	CC="$(tc-getBUILD_CC)" \
-	CFLAGS="-O1 -pipe" \
-	CPPFLAGS="-U_FORTIFY_SOURCE" \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir $1)"
-	emake -j1 check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test nptl
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally real_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Newer versions get fancy with libm linkage to include vectorized support.
-	# While we don't really need a ldscript here, portage QA checks get upset.
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		dosym ../../$(get_libdir)/libm-${upstream_pv}.so $(alt_usrlibdir)/libm-${upstream_pv}.so
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if in_iuse suid && ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		cd "${ED}"$(alt_libdir)/..
-		[[ -e lib ]] || mkdir lib
-		cd "${ED}"$(alt_usrlibdir)/..
-		[[ -e lib ]] || mkdir lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym /usr/$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		elog "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		# if the host locales.gen contains no entries, we'll install everything
-		local locale_list="${EROOT}etc/locale.gen"
-		if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-			ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-			locale_list="${EROOT}usr/share/i18n/SUPPORTED"
-		fi
-		locale-gen -j $(makeopts_jobs) --config "${locale_list}"
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-23 21:39 Thomas Deutschmann
  0 siblings, 0 replies; 1076+ messages in thread
From: Thomas Deutschmann @ 2017-10-23 21:39 UTC (permalink / raw
  To: gentoo-commits

commit:     d94b90d7ee42ec302bf80413c53fedb1b4df7df5
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 23 21:39:24 2017 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Oct 23 21:39:24 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d94b90d7

sys-libs/glibc: x86 stable (bug #628180)

Package-Manager: Portage-2.3.11, Repoman-2.3.3

 sys-libs/glibc/glibc-2.25-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r8.ebuild b/sys-libs/glibc/glibc-2.25-r8.ebuild
index 38b69a7237a..a90c03dd8f0 100644
--- a/sys-libs/glibc/glibc-2.25-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r8.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-24  6:24 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2017-10-24  6:24 UTC (permalink / raw
  To: gentoo-commits

commit:     fd3a9bbebde49e985320cd02662c6cd50ab7622c
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 24 06:24:33 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Oct 24 06:24:38 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fd3a9bbe

sys-libs/glibc: stable 2.25-r8 for ia64, bug #628180

Package-Manager: Portage-2.3.12, Repoman-2.3.3
RepoMan-Options: --include-arches="ia64"

 sys-libs/glibc/glibc-2.25-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r8.ebuild b/sys-libs/glibc/glibc-2.25-r8.ebuild
index a90c03dd8f0..e7fa6b445df 100644
--- a/sys-libs/glibc/glibc-2.25-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r8.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-24 21:15 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2017-10-24 21:15 UTC (permalink / raw
  To: gentoo-commits

commit:     e886f21a6c574b683053df9c8a4447269a18b362
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 24 21:13:16 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Oct 24 21:15:40 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e886f21a

sys-libs/glibc: stable 2.25-r8 for ppc/ppc64, bug #628180

Package-Manager: Portage-2.3.12, Repoman-2.3.3
RepoMan-Options: --include-arches="ppc ppc64"

 sys-libs/glibc/glibc-2.25-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r8.ebuild b/sys-libs/glibc/glibc-2.25-r8.ebuild
index e7fa6b445df..f43f3710497 100644
--- a/sys-libs/glibc/glibc-2.25-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r8.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh ~sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-25 22:03 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2017-10-25 22:03 UTC (permalink / raw
  To: gentoo-commits

commit:     cff6ab64216d6654873a579d5abafb7cbdab2002
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 25 22:03:39 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Oct 25 22:03:49 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cff6ab64

sys-libs/glibc: stable 2.25-r8 for hppa, bug #628180 (thanks to Rolf Eike Beer)

Package-Manager: Portage-2.3.12, Repoman-2.3.3
RepoMan-Options: --include-arches="hppa"

 sys-libs/glibc/glibc-2.25-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r8.ebuild b/sys-libs/glibc/glibc-2.25-r8.ebuild
index f43f3710497..7c0b065d1aa 100644
--- a/sys-libs/glibc/glibc-2.25-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r8.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh ~sparc x86"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh ~sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-26 18:51 Matt Turner
  0 siblings, 0 replies; 1076+ messages in thread
From: Matt Turner @ 2017-10-26 18:51 UTC (permalink / raw
  To: gentoo-commits

commit:     9626fedb55e76b5dcb79f151f0af5af6e2810e95
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 26 18:51:09 2017 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Oct 26 18:51:09 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9626fedb

sys-libs/glibc-2.25-r8: alpha stable, bug 628180

 sys-libs/glibc/glibc-2.25-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r8.ebuild b/sys-libs/glibc/glibc-2.25-r8.ebuild
index 7c0b065d1aa..e36ef8b359a 100644
--- a/sys-libs/glibc/glibc-2.25-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r8.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh ~sparc x86"
+KEYWORDS="alpha ~amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh ~sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-27 22:31 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-10-27 22:31 UTC (permalink / raw
  To: gentoo-commits

commit:     bbf35ca26d61f179cd22066eb59c466171b36829
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 27 22:30:59 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Oct 27 22:31:25 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bbf35ca2

sys-libs/glibc: Add flag to build locale data in src_install, bug 146882

Based on the patch there by SpanKY; to be included in 2.27 and later.

Bug: https://bugs.gentoo.org/146882
Package-Manager: Portage-2.3.13, Repoman-2.3.4

 sys-libs/glibc/glibc-9999.ebuild | 28 ++++++++++++++++++++--------
 sys-libs/glibc/metadata.xml      |  1 +
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f8e270e663f..399cfc13dc6 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -33,7 +33,7 @@ PATCH_VER="3"
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
 
-IUSE="audit caps debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+IUSE="audit caps compile-locales debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
 
 # Min kernel version nptl requires
 : ${NPTL_KERN_VER:="2.6.32"}
@@ -551,6 +551,19 @@ src_test() {
 	foreach_abi do_src_test || die "tests failed"
 }
 
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local locale_list="${root}/etc/locale.gen"
+	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+		locale_list="${root}/usr/share/i18n/SUPPORTED"
+	fi
+
+	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+}
+
 glibc_do_src_install() {
 	local builddir=$(builddir nptl)
 	cd "${builddir}"
@@ -714,6 +727,11 @@ glibc_do_src_install() {
 	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
 	# creation of the "factory" symlink in pkg_postinst().
 	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen "${ED}"
+	fi
 }
 
 glibc_headers_install() {
@@ -773,12 +791,6 @@ pkg_postinst() {
 		# errors from this step #253697
 		/sbin/telinit U 2>/dev/null
 
-		# if the host locales.gen contains no entries, we'll install everything
-		local locale_list="${EROOT}etc/locale.gen"
-		if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-			ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-			locale_list="${EROOT}usr/share/i18n/SUPPORTED"
-		fi
-		locale-gen -j $(makeopts_jobs) --config "${locale_list}"
+		use compile-locales || run_locale_gen "${EROOT}"
 	fi
 }

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index e6ebe220ca6..b32c212616a 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -6,6 +6,7 @@
  <name>Gentoo Toolchain Project</name>
 </maintainer>
 <use>
+ <flag name="compile-locales">build *all* locales in src_install; this is generally meant for stage building only as it ignores /etc/locale.gen file and can be pretty slow</flag>
  <flag name="debug">When USE=hardened, allow fortify/stack violations to dump core (SIGABRT) and not kill self (SIGKILL)</flag>
  <flag name="gd">build memusage and memusagestat tools</flag>
  <flag name="nscd">Build, and enable support for, the Name Service Cache Daemon</flag>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-27 23:30 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-10-27 23:30 UTC (permalink / raw
  To: gentoo-commits

commit:     d93339d7f5bfe90901a8c6921d1c221b54c8302a
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 27 23:30:07 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Oct 27 23:30:19 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d93339d7

sys-libs/glibc: Revision bump to 2.25 patchlevel 12, unkeyworded so far

Resolves CVE-2017-15670, CVE-2017-15804, CVE-2016-6261

Bug: https://bugs.gentoo.org/634920
Bug: https://bugs.gentoo.org/635010
Bug: https://bugs.gentoo.org/635118
Package-Manager: Portage-2.3.13, Repoman-2.3.4

 sys-libs/glibc/Manifest             |   1 +
 sys-libs/glibc/glibc-2.25-r9.ebuild | 154 ++++++++++++++++++++++++++++++++++++
 2 files changed, 155 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 88147f03cd5..d47efc91130 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,6 +17,7 @@ DIST glibc-2.23.tar.xz 13455260 SHA256 94efeb00e4603c8546209cefb3e1a50a5315c86fa
 DIST glibc-2.24-patches-10.tar.bz2 73586 SHA256 d479033b63ff796fea56fb1bde390c442021acd856994b15c983b4a89e46fbbe SHA512 fc9191a85da53a2515bbaab228648936682e04267284049468e0c82284f618ab2907b9247baca701e16edc50640199ff6d8e2a6a93ccbd5a9d3b0eb73cc484ca WHIRLPOOL 7afe94307900a70de2f5e028d8ec9e0f4b06b661ec6493217e51a13d750f891e10b45c0f66d86fa83c16cc3ce539bb257039b33bc3e363469cd03502d956d75e
 DIST glibc-2.24.tar.xz 13554048 SHA256 99d4a3e8efd144d71488e478f62587578c0f4e1fa0b4eed47ee3d4975ebeb5d3 SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb WHIRLPOOL be82b47fc73f7e780e8e73a5f58b313d8e861d5ea8c4320f95ef0d8c1e125ff011d61dcfc0380be0e83868bd8c3299de1ea662da7fc8d709050e89b2c126e3eb
 DIST glibc-2.25-patches-11.tar.bz2 64221 SHA256 38c76c844238a7bbaecc85b359e67af6a98a1614f3196f25d85f83dec4358e99 SHA512 cbbbca9653f55f0cb3b73c38c979cb439c87b172819f3e999d2b435d59cd2bef2c89f11a398300c53f447ad433ee87f47a0f3e890c78f8694705c788455325dd WHIRLPOOL e61203ac129d7283f3beda1421e1365da58c229bcb6b6a1f8b71755d9ea0e2bfb64b8be69ab7698861a593d4b98ab6163d574f3c215fba0a0d9e6a1b15d2eed5
+DIST glibc-2.25-patches-12.tar.bz2 65396 SHA256 60a8901ceab4066661285cdbf7559d3a1f66bf468c5c1a5ecdde7f8ead282d3e SHA512 6af8c304ba70b42dfda294873d9a138d6c98e7a46496e305b2cac99a085d1ad3d00315162d1e1458e651de95e158bd35be74406a3f44fde13182e30baa663fcb WHIRLPOOL 96684d379d65ca6e4da7d397d4b803e0b0516080223de86080d6bbf3cae6a17b9fc8922d6fc2071b3116f35136378d85eb6671c7d9f7cf0f2135b66d1573bb90
 DIST glibc-2.25.tar.xz 13873900 SHA256 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e WHIRLPOOL dc2fafaa4a0e5581268338453838a03ed0c5e7a2af844e8fb7086ab8d3ae48efbdbe6f25db1d089ae669cd2f8b0412f690d965506753d86f8525da2df59b7953
 DIST glibc-2.26-patches-2.tar.bz2 68040 SHA256 c40f03059d389fd8b22b54f83c0a669c44a38ee84cc359cb86d8f6dbdd1b957f SHA512 2b54d6e33b29d5ee5e4d4b64f299bf15e22ece5ce6555dafe43fd97ec8a2d9ef0645075ff24dc593ec6f89e02caf40c25a72af93ecd11113fba77268ccf486e2 WHIRLPOOL 59c54cdd2e3e64091dd206ad6b5ff467eff6c0d7f8ef5ab11504a4e6cfe958f762b9de2fbe8b6004a9e19963520a84a493ccf03908a78ea0a452dbc28e0df1e5
 DIST glibc-2.26.tar.xz 14682748 SHA256 e54e0a934cd2bc94429be79da5e9385898d2306b9eaf3c92d5a77af96190f6bd SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0 WHIRLPOOL 9091c3bccc9b590de6b9595aa391ba01091f0c301bd9199d7c48fbeaeeb013ec9c683c68b65b59c5a69e3905b7f842cca1b0a410431967ecb3a1229b8535486f

diff --git a/sys-libs/glibc/glibc-2.25-r9.ebuild b/sys-libs/glibc/glibc-2.25-r9.ebuild
new file mode 100644
index 00000000000..89b790eb79c
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.25-r9.ebuild
@@ -0,0 +1,154 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit toolchain-glibc
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+KEYWORDS=""
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+case ${PV} in
+9999*)
+	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+	EGIT_SOURCEDIRS="${S}"
+	inherit git-2
+	;;
+*)
+	RELEASE_VER=${PV}
+	;;
+esac
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
+PATCH_VER="12"                                  # Gentoo patchset
+: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
+
+GLIBC_PATCH_EXCLUDE+=" 0005_all_sys-types.h-drop-sys-sysmacros.h-include.patch"
+
+IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2"
+RDEPEND="${COMMON_DEPEND}
+	!sys-kernel/ps3-sources
+	sys-apps/gentoo-functions
+	!sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !crosscompile_opts_headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.7
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.7
+		virtual/os-headers"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+	local devspace="HTTP~vapier/dist/URI HTTP~dilfridge/distfiles/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
+	devspace=${devspace//HTTP/https://dev.gentoo.org/}
+	echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+src_unpack() {
+	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+
+	toolchain-glibc_src_unpack
+}
+
+src_prepare() {
+	toolchain-glibc_src_prepare
+
+	cd "${S}"
+
+	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
+
+	if use hardened ; then
+		# We don't enable these for non-hardened as the output is very terse --
+		# it only states that a crash happened.  The default upstream behavior
+		# includes backtraces and symbols.
+		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
+
+		if use debug ; then
+			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+			sed -i \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				debug/Makefile || die
+		fi
+	fi
+
+	case $(gcc-fullversion) in
+	4.8.[0-3]|4.9.0)
+		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
+		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
+		die "need to switch compilers #547420"
+		;;
+	esac
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-28 19:47 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2017-10-28 19:47 UTC (permalink / raw
  To: gentoo-commits

commit:     77c4a5bd12e05a6a67be5419120bff49ebbdf141
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 28 19:47:44 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Oct 28 19:47:49 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=77c4a5bd

sys-libs/glibc: stable 2.25-r8 for sparc, bug #628180 (thanks to Rolf Eike Beer)

Package-Manager: Portage-2.3.13, Repoman-2.3.4
RepoMan-Options: --include-arches="sparc"

 sys-libs/glibc/glibc-2.25-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r8.ebuild b/sys-libs/glibc/glibc-2.25-r8.ebuild
index e36ef8b359a..6931a6deaff 100644
--- a/sys-libs/glibc/glibc-2.25-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r8.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha ~amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh ~sparc x86"
+KEYWORDS="alpha ~amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-29 11:13 Manuel Rüger
  0 siblings, 0 replies; 1076+ messages in thread
From: Manuel Rüger @ 2017-10-29 11:13 UTC (permalink / raw
  To: gentoo-commits

commit:     227736e0c36a386e7c28c214f4ae5ce1baf84c85
Author:     Manuel Rüger <mrueg <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 29 11:13:15 2017 +0000
Commit:     Manuel Rüger <mrueg <AT> gentoo <DOT> org>
CommitDate: Sun Oct 29 11:13:15 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=227736e0

sys-libs/glibc: Stable on amd64

Package-Manager: Portage-2.3.13, Repoman-2.3.3

 sys-libs/glibc/glibc-2.25-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r8.ebuild b/sys-libs/glibc/glibc-2.25-r8.ebuild
index 6931a6deaff..2e4018250ff 100644
--- a/sys-libs/glibc/glibc-2.25-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r8.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha ~amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
+KEYWORDS="alpha amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-10-30 17:50 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-10-30 17:50 UTC (permalink / raw
  To: gentoo-commits

commit:     a23b2f79fd445c671ace10d6b3841390fa52e59e
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 30 17:50:05 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Oct 30 17:50:31 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a23b2f79

sys-libs/glibc: Re-add keywords

Package-Manager: Portage-2.3.13, Repoman-2.3.4

 sys-libs/glibc/glibc-2.25-r9.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.25-r9.ebuild b/sys-libs/glibc/glibc-2.25-r9.ebuild
index 89b790eb79c..677fd2bb518 100644
--- a/sys-libs/glibc/glibc-2.25-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r9.ebuild
@@ -9,8 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-KEYWORDS=""
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-11-11 17:50 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-11-11 17:50 UTC (permalink / raw
  To: gentoo-commits

commit:     6d672e151e8b5cf9d498fb29788fb7b86af2ec5d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 11 17:48:48 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Nov 11 17:49:39 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d672e15

sys-libs/glibc: Revision bump, untested. Keywording candidate.

Tip of 2.26 release branch plus selected fixes.

Package-Manager: Portage-2.3.13, Repoman-2.3.4

 sys-libs/glibc/Manifest             |   1 +
 sys-libs/glibc/glibc-2.26-r3.ebuild | 789 ++++++++++++++++++++++++++++++++++++
 2 files changed, 790 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index d47efc91130..d4a9a6be5f8 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,5 +20,6 @@ DIST glibc-2.25-patches-11.tar.bz2 64221 SHA256 38c76c844238a7bbaecc85b359e67af6
 DIST glibc-2.25-patches-12.tar.bz2 65396 SHA256 60a8901ceab4066661285cdbf7559d3a1f66bf468c5c1a5ecdde7f8ead282d3e SHA512 6af8c304ba70b42dfda294873d9a138d6c98e7a46496e305b2cac99a085d1ad3d00315162d1e1458e651de95e158bd35be74406a3f44fde13182e30baa663fcb WHIRLPOOL 96684d379d65ca6e4da7d397d4b803e0b0516080223de86080d6bbf3cae6a17b9fc8922d6fc2071b3116f35136378d85eb6671c7d9f7cf0f2135b66d1573bb90
 DIST glibc-2.25.tar.xz 13873900 SHA256 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e WHIRLPOOL dc2fafaa4a0e5581268338453838a03ed0c5e7a2af844e8fb7086ab8d3ae48efbdbe6f25db1d089ae669cd2f8b0412f690d965506753d86f8525da2df59b7953
 DIST glibc-2.26-patches-2.tar.bz2 68040 SHA256 c40f03059d389fd8b22b54f83c0a669c44a38ee84cc359cb86d8f6dbdd1b957f SHA512 2b54d6e33b29d5ee5e4d4b64f299bf15e22ece5ce6555dafe43fd97ec8a2d9ef0645075ff24dc593ec6f89e02caf40c25a72af93ecd11113fba77268ccf486e2 WHIRLPOOL 59c54cdd2e3e64091dd206ad6b5ff467eff6c0d7f8ef5ab11504a4e6cfe958f762b9de2fbe8b6004a9e19963520a84a493ccf03908a78ea0a452dbc28e0df1e5
+DIST glibc-2.26-patches-3.tar.bz2 280970 SHA256 e4aabc1648214cff2782ca4b263dafd049082be95329ccc2dbda847ea4ce8fc0 SHA512 d199d1cfb1346e2406d6a575e23f82d08354247be20dbdd8bfe52f58c2c70feeeaadb0deb01b877e550475a36fcb6cb1cfc7ad188cdea16e88f0abe2f55bf6ee WHIRLPOOL ce362ac323bdef96a67f5584ca9f26da7eb27e22fcf6943b35d048be41ca32b1f51f558c4c0a94eeb88988f4b99c9a03148f77d8895c65ae6f4f4fb8a1631809
 DIST glibc-2.26.tar.xz 14682748 SHA256 e54e0a934cd2bc94429be79da5e9385898d2306b9eaf3c92d5a77af96190f6bd SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0 WHIRLPOOL 9091c3bccc9b590de6b9595aa391ba01091f0c301bd9199d7c48fbeaeeb013ec9c683c68b65b59c5a69e3905b7f842cca1b0a410431967ecb3a1229b8535486f
 DIST glibc-9999-patches-3.tar.bz2 19892 SHA256 97f60ed6debd495610b123d7a27227e75942bea1a0fb1e5f78833a6f3bbe6c64 SHA512 75084b86a83d447d3a4b3959fa2a93d849e304ba9473ebec5570ca4fb5e2f8dfb38548faf3abc9fbd29b529f2c608b52eb2ef2e6e9a2ad5bea9a9298a19ef596 WHIRLPOOL 04a5c30aabf72530fa96fa3a8eadf8207d85d3a2a948ba5f4b72c0deeeae24e7eb71b99875f0e9b1018051fabb4a23630b41873fa4ff0d6ba9778ca6051212bf

diff --git a/sys-libs/glibc/glibc-2.26-r3.ebuild b/sys-libs/glibc/glibc-2.26-r3.ebuild
new file mode 100644
index 00000000000..df414d6cdce
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.26-r3.ebuild
@@ -0,0 +1,789 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit prefix toolchain-glibc
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+
+# Gentoo patchset
+PATCH_VER=3
+
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
+
+IUSE="audit caps debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Min kernel version nptl requires
+: ${NPTL_KERN_VER:="2.6.32"}
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+"
+RDEPEND="${COMMON_DEPEND}
+	!sys-kernel/ps3-sources
+	sys-apps/gentoo-functions
+	!sys-libs/nss-db
+"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !crosscompile_opts_headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.9
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.9
+		virtual/os-headers
+	"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# the phases
+#
+
+pkg_pretend() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ ${ROOT} == "/" ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+		# The high rev # is to allow people to downgrade between -r# versions.
+		# We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine.
+		# Hopefully we never actually use a r# this high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction"
+			die "Aborting to save your system"
+		fi
+
+		if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
+		then
+			eerror "Your patched vendor kernel is broken.  You need to get an"
+			eerror "update from whoever is providing the kernel to you."
+			eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227"
+			eerror "https://bugs.gentoo.org/262698"
+			die "Keeping your system alive, say thank you"
+		fi
+
+		if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
+		then
+			eerror "Your old kernel is broken.  You need to update it to"
+			eerror "a newer version as syscall(<bignum>) will break."
+			eerror "https://bugs.gentoo.org/279260"
+			die "Keeping your system alive, say thank you"
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	use hardened && ! tc-enables-pie && \
+		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
+
+	# Make sure host system is up to date #394453
+	if has_version '<sys-libs/glibc-2.13' && \
+	   [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]]
+	then
+		ebegin "Scanning system for __guard to see if you need to rebuild first ..."
+		local files=$(
+			scanelf -qys__guard -F'#s%F' \
+				"${EROOT}"/*bin/ \
+				"${EROOT}"/lib* \
+				"${EROOT}"/usr/*bin/ \
+				"${EROOT}"/usr/lib* | \
+				egrep -v \
+					-e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \
+					-e "^${EROOT}/sbin/(ldconfig|sln)$"
+		)
+		[[ -z ${files} ]]
+		if ! eend $? ; then
+			eerror "Your system still has old SSP __guard symbols.  You need to"
+			eerror "rebuild all the packages that provide these files first:"
+			eerror "${files}"
+			die "old __guard detected"
+		fi
+	fi
+}
+
+src_unpack() {
+	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+
+	setup_env
+
+	# Check NPTL support _before_ we unpack things to save some time
+	check_nptl_support
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${S}"
+	touch locale/C-translit.h #185476 #218003
+
+	cd "${WORKDIR}"
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER} ..."
+		eapply "${WORKDIR}"/patches
+		elog "Done."
+	fi
+
+	if just_headers ; then
+		if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
+			# mips peeps like to screw with us.  if building headers,
+			# we don't have a real compiler, so we can't let them
+			# insert -mabi on us.
+			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
+			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
+		fi
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+
+	if use hardened ; then
+		# We don't enable these for non-hardened as the output is very terse --
+		# it only states that a crash happened.  The default upstream behavior
+		# includes backtraces and symbols.
+		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
+
+		if use debug ; then
+			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+			sed -i \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				debug/Makefile || die
+		fi
+	fi
+}
+
+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 $1"
+
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS ; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+
+	# The glibc configure script doesn't properly use LDFLAGS all the time.
+	export CC="$(tc-getCC ${CTARGET}) ${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)"
+	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
+
+	echo
+
+	local myconf=()
+
+	# set addons
+	pushd "${S}" > /dev/null
+	local addons=$(echo */configure | sed \
+		-e 's:/configure::g' \
+		-e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
+		-e 's: \+$::' \
+		-e 's! !,!g' \
+		-e 's!^!,!' \
+		-e '/^,\*$/d')
+	[[ -d ports ]] && addons+=",ports"
+	popd > /dev/null
+
+	case ${CTARGET} in
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=all )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	if [[ $1 == "nptl" ]] ; then
+		myconf+=( --enable-kernel=${NPTL_KERN_VER} )
+	else
+		die "invalid pthread option"
+	fi
+	myconf+=( --enable-add-ons="${addons#,}" )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		--sysconfdir="${EPREFIX}/etc"
+		--localstatedir="${EPREFIX}/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(in_iuse systemtap && use_enable systemtap)
+		$(in_iuse nscd && use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="${EPREFIX}/sbin"
+	export libc_cv_slibdir="${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 "$1")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+			mkdir -p sunrpc
+			cp $(which rpcgen) sunrpc/cross-rpcgen || die
+			touch -t 202001010101 sunrpc/cross-rpcgen || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		${EXTRA_ECONF}
+	)
+
+	local addons
+	[[ -d ${S}/ports ]] && addons+=",ports"
+	myconf+=( --enable-add-ons="${addons#,}" )
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	CC="$(tc-getBUILD_CC)" \
+	CFLAGS="-O1 -pipe" \
+	CPPFLAGS="-U_FORTIFY_SOURCE" \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir $1)"
+	emake -j1 check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test nptl
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}$(alt_prefix)" install || die
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally real_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Newer versions get fancy with libm linkage to include vectorized support.
+	# While we don't really need a ldscript here, portage QA checks get upset.
+	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		dosym ../../$(get_libdir)/libm-${upstream_pv}.so $(alt_usrlibdir)/libm-${upstream_pv}.so
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if in_iuse suid && ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		cd "${ED}"$(alt_libdir)/..
+		[[ -e lib ]] || mkdir lib
+		cd "${ED}"$(alt_usrlibdir)/..
+		[[ -e lib ]] || mkdir lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+	src_strip
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		elog "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ ${ROOT} != "/" ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+	fi
+
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		# if the host locales.gen contains no entries, we'll install everything
+		local locale_list="${EROOT}etc/locale.gen"
+		if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+			ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+			locale_list="${EROOT}usr/share/i18n/SUPPORTED"
+		fi
+		locale-gen -j $(makeopts_jobs) --config "${locale_list}"
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-11-11 18:00 Thomas Deutschmann
  0 siblings, 0 replies; 1076+ messages in thread
From: Thomas Deutschmann @ 2017-11-11 18:00 UTC (permalink / raw
  To: gentoo-commits

commit:     331d077b97a5de6c18b13bf3fab4c2a9a6003930
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 11 17:59:46 2017 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sat Nov 11 18:00:12 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=331d077b

sys-libs/glibc: x86 stable (bug #637140)

Package-Manager: Portage-2.3.13, Repoman-2.3.4

 sys-libs/glibc/glibc-2.25-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r9.ebuild b/sys-libs/glibc/glibc-2.25-r9.ebuild
index 677fd2bb518..d90655f2070 100644
--- a/sys-libs/glibc/glibc-2.25-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r9.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-11-11 21:23 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-11-11 21:23 UTC (permalink / raw
  To: gentoo-commits

commit:     13372b7aa467ce48bad99dfa4fa0b81f43404606
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 11 21:21:39 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Nov 11 21:22:28 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=13372b7a

sys-libs/glibc: Be slightly less verbose in the ebuild

Package-Manager: Portage-2.3.13, Repoman-2.3.4

 sys-libs/glibc/glibc-2.26-r3.ebuild | 4 ++--
 sys-libs/glibc/glibc-9999.ebuild    | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r3.ebuild b/sys-libs/glibc/glibc-2.26-r3.ebuild
index df414d6cdce..673ba3408ce 100644
--- a/sys-libs/glibc/glibc-2.26-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r3.ebuild
@@ -215,9 +215,9 @@ src_unpack() {
 
 src_prepare() {
 	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER} ..."
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
 		eapply "${WORKDIR}"/patches
-		elog "Done."
+		einfo "Done."
 	fi
 
 	if just_headers ; then

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 399cfc13dc6..25412dcedbb 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -226,9 +226,9 @@ src_unpack() {
 
 src_prepare() {
 	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER} ..."
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
 		eapply "${WORKDIR}"/patches
-		elog "Done."
+		einfo "Done."
 	fi
 
 	if just_headers ; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-11-11 23:23 Matt Turner
  0 siblings, 0 replies; 1076+ messages in thread
From: Matt Turner @ 2017-11-11 23:23 UTC (permalink / raw
  To: gentoo-commits

commit:     75491d9592569ec4fa4d1534d6c264f8f01e52d0
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 11 23:23:31 2017 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Sat Nov 11 23:23:31 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=75491d95

sys-libs/glibc-2.25-r9: alpha stable, bug 637140

 sys-libs/glibc/glibc-2.25-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r9.ebuild b/sys-libs/glibc/glibc-2.25-r9.ebuild
index d90655f2070..344a8507305 100644
--- a/sys-libs/glibc/glibc-2.25-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r9.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
+KEYWORDS="alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-11-11 23:34 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2017-11-11 23:34 UTC (permalink / raw
  To: gentoo-commits

commit:     0f01777e134ac1c6e6769bf2cdbaa595716a1049
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 11 23:33:45 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Nov 11 23:33:45 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0f01777e

sys-libs/glibc: stable 2.25-r9 for ia64/ppc/ppc64, bug #637140

Package-Manager: Portage-2.3.13, Repoman-2.3.4
RepoMan-Options: --include-arches="ia64 ppc ppc64"

 sys-libs/glibc/glibc-2.25-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r9.ebuild b/sys-libs/glibc/glibc-2.25-r9.ebuild
index 344a8507305..be7fea22eaa 100644
--- a/sys-libs/glibc/glibc-2.25-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r9.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
+KEYWORDS="alpha ~amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh ~sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-11-12  1:10 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-11-12  1:10 UTC (permalink / raw
  To: gentoo-commits

commit:     65134c71c621e72ff609235dabb0b598621be98e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 12 01:09:47 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Nov 12 01:10:36 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65134c71

sys-libs/glibc: Increase patchlevel. Only changes in the test suite.

Package-Manager: Portage-2.3.13, Repoman-2.3.4

 sys-libs/glibc/Manifest             | 2 +-
 sys-libs/glibc/glibc-2.26-r3.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index d4a9a6be5f8..b4f0de518fd 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,6 +20,6 @@ DIST glibc-2.25-patches-11.tar.bz2 64221 SHA256 38c76c844238a7bbaecc85b359e67af6
 DIST glibc-2.25-patches-12.tar.bz2 65396 SHA256 60a8901ceab4066661285cdbf7559d3a1f66bf468c5c1a5ecdde7f8ead282d3e SHA512 6af8c304ba70b42dfda294873d9a138d6c98e7a46496e305b2cac99a085d1ad3d00315162d1e1458e651de95e158bd35be74406a3f44fde13182e30baa663fcb WHIRLPOOL 96684d379d65ca6e4da7d397d4b803e0b0516080223de86080d6bbf3cae6a17b9fc8922d6fc2071b3116f35136378d85eb6671c7d9f7cf0f2135b66d1573bb90
 DIST glibc-2.25.tar.xz 13873900 SHA256 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e WHIRLPOOL dc2fafaa4a0e5581268338453838a03ed0c5e7a2af844e8fb7086ab8d3ae48efbdbe6f25db1d089ae669cd2f8b0412f690d965506753d86f8525da2df59b7953
 DIST glibc-2.26-patches-2.tar.bz2 68040 SHA256 c40f03059d389fd8b22b54f83c0a669c44a38ee84cc359cb86d8f6dbdd1b957f SHA512 2b54d6e33b29d5ee5e4d4b64f299bf15e22ece5ce6555dafe43fd97ec8a2d9ef0645075ff24dc593ec6f89e02caf40c25a72af93ecd11113fba77268ccf486e2 WHIRLPOOL 59c54cdd2e3e64091dd206ad6b5ff467eff6c0d7f8ef5ab11504a4e6cfe958f762b9de2fbe8b6004a9e19963520a84a493ccf03908a78ea0a452dbc28e0df1e5
-DIST glibc-2.26-patches-3.tar.bz2 280970 SHA256 e4aabc1648214cff2782ca4b263dafd049082be95329ccc2dbda847ea4ce8fc0 SHA512 d199d1cfb1346e2406d6a575e23f82d08354247be20dbdd8bfe52f58c2c70feeeaadb0deb01b877e550475a36fcb6cb1cfc7ad188cdea16e88f0abe2f55bf6ee WHIRLPOOL ce362ac323bdef96a67f5584ca9f26da7eb27e22fcf6943b35d048be41ca32b1f51f558c4c0a94eeb88988f4b99c9a03148f77d8895c65ae6f4f4fb8a1631809
+DIST glibc-2.26-patches-4.tar.bz2 315447 SHA256 2f49edd3a45bc5bb3c16f86228bfdeaba7e2b48b7eefad63e2ffa2ed3f6d628e SHA512 04d229e5f9342d62f2fce039c70489609886782d8aabd49403863a1a679e3b0890ca26c129088738a4af7ef6d95c74f24fb3c4d03695bf7ba6e45eca4de1a5f0 WHIRLPOOL 06b31af65b4f6092fa7b8776507cfdd014649670dae49c1d6a35ce61b3345d08acb9e09076a8cfe310ffe7d698d212310c8f497366c57240a463a31a39a175d9
 DIST glibc-2.26.tar.xz 14682748 SHA256 e54e0a934cd2bc94429be79da5e9385898d2306b9eaf3c92d5a77af96190f6bd SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0 WHIRLPOOL 9091c3bccc9b590de6b9595aa391ba01091f0c301bd9199d7c48fbeaeeb013ec9c683c68b65b59c5a69e3905b7f842cca1b0a410431967ecb3a1229b8535486f
 DIST glibc-9999-patches-3.tar.bz2 19892 SHA256 97f60ed6debd495610b123d7a27227e75942bea1a0fb1e5f78833a6f3bbe6c64 SHA512 75084b86a83d447d3a4b3959fa2a93d849e304ba9473ebec5570ca4fb5e2f8dfb38548faf3abc9fbd29b529f2c608b52eb2ef2e6e9a2ad5bea9a9298a19ef596 WHIRLPOOL 04a5c30aabf72530fa96fa3a8eadf8207d85d3a2a948ba5f4b72c0deeeae24e7eb71b99875f0e9b1018051fabb4a23630b41873fa4ff0d6ba9778ca6051212bf

diff --git a/sys-libs/glibc/glibc-2.26-r3.ebuild b/sys-libs/glibc/glibc-2.26-r3.ebuild
index 673ba3408ce..e653041df34 100644
--- a/sys-libs/glibc/glibc-2.26-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r3.ebuild
@@ -28,7 +28,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER="4.7.3-r1"
 
 # Gentoo patchset
-PATCH_VER=3
+PATCH_VER=4
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-11-12 14:16 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-11-12 14:16 UTC (permalink / raw
  To: gentoo-commits

commit:     99c7ef8fc9f4d90fc4b702713965efa909dd9bfc
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 12 12:17:09 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Nov 12 14:15:28 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=99c7ef8f

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.13, Repoman-2.3.4

 sys-libs/glibc/Manifest             |   1 -
 sys-libs/glibc/glibc-2.26-r2.ebuild | 796 ------------------------------------
 2 files changed, 797 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index b4f0de518fd..8a2c0db1f9b 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,7 +19,6 @@ DIST glibc-2.24.tar.xz 13554048 SHA256 99d4a3e8efd144d71488e478f62587578c0f4e1fa
 DIST glibc-2.25-patches-11.tar.bz2 64221 SHA256 38c76c844238a7bbaecc85b359e67af6a98a1614f3196f25d85f83dec4358e99 SHA512 cbbbca9653f55f0cb3b73c38c979cb439c87b172819f3e999d2b435d59cd2bef2c89f11a398300c53f447ad433ee87f47a0f3e890c78f8694705c788455325dd WHIRLPOOL e61203ac129d7283f3beda1421e1365da58c229bcb6b6a1f8b71755d9ea0e2bfb64b8be69ab7698861a593d4b98ab6163d574f3c215fba0a0d9e6a1b15d2eed5
 DIST glibc-2.25-patches-12.tar.bz2 65396 SHA256 60a8901ceab4066661285cdbf7559d3a1f66bf468c5c1a5ecdde7f8ead282d3e SHA512 6af8c304ba70b42dfda294873d9a138d6c98e7a46496e305b2cac99a085d1ad3d00315162d1e1458e651de95e158bd35be74406a3f44fde13182e30baa663fcb WHIRLPOOL 96684d379d65ca6e4da7d397d4b803e0b0516080223de86080d6bbf3cae6a17b9fc8922d6fc2071b3116f35136378d85eb6671c7d9f7cf0f2135b66d1573bb90
 DIST glibc-2.25.tar.xz 13873900 SHA256 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e WHIRLPOOL dc2fafaa4a0e5581268338453838a03ed0c5e7a2af844e8fb7086ab8d3ae48efbdbe6f25db1d089ae669cd2f8b0412f690d965506753d86f8525da2df59b7953
-DIST glibc-2.26-patches-2.tar.bz2 68040 SHA256 c40f03059d389fd8b22b54f83c0a669c44a38ee84cc359cb86d8f6dbdd1b957f SHA512 2b54d6e33b29d5ee5e4d4b64f299bf15e22ece5ce6555dafe43fd97ec8a2d9ef0645075ff24dc593ec6f89e02caf40c25a72af93ecd11113fba77268ccf486e2 WHIRLPOOL 59c54cdd2e3e64091dd206ad6b5ff467eff6c0d7f8ef5ab11504a4e6cfe958f762b9de2fbe8b6004a9e19963520a84a493ccf03908a78ea0a452dbc28e0df1e5
 DIST glibc-2.26-patches-4.tar.bz2 315447 SHA256 2f49edd3a45bc5bb3c16f86228bfdeaba7e2b48b7eefad63e2ffa2ed3f6d628e SHA512 04d229e5f9342d62f2fce039c70489609886782d8aabd49403863a1a679e3b0890ca26c129088738a4af7ef6d95c74f24fb3c4d03695bf7ba6e45eca4de1a5f0 WHIRLPOOL 06b31af65b4f6092fa7b8776507cfdd014649670dae49c1d6a35ce61b3345d08acb9e09076a8cfe310ffe7d698d212310c8f497366c57240a463a31a39a175d9
 DIST glibc-2.26.tar.xz 14682748 SHA256 e54e0a934cd2bc94429be79da5e9385898d2306b9eaf3c92d5a77af96190f6bd SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0 WHIRLPOOL 9091c3bccc9b590de6b9595aa391ba01091f0c301bd9199d7c48fbeaeeb013ec9c683c68b65b59c5a69e3905b7f842cca1b0a410431967ecb3a1229b8535486f
 DIST glibc-9999-patches-3.tar.bz2 19892 SHA256 97f60ed6debd495610b123d7a27227e75942bea1a0fb1e5f78833a6f3bbe6c64 SHA512 75084b86a83d447d3a4b3959fa2a93d849e304ba9473ebec5570ca4fb5e2f8dfb38548faf3abc9fbd29b529f2c608b52eb2ef2e6e9a2ad5bea9a9298a19ef596 WHIRLPOOL 04a5c30aabf72530fa96fa3a8eadf8207d85d3a2a948ba5f4b72c0deeeae24e7eb71b99875f0e9b1018051fabb4a23630b41873fa4ff0d6ba9778ca6051212bf

diff --git a/sys-libs/glibc/glibc-2.26-r2.ebuild b/sys-libs/glibc/glibc-2.26-r2.ebuild
deleted file mode 100644
index 8b6e1b1520b..00000000000
--- a/sys-libs/glibc/glibc-2.26-r2.ebuild
+++ /dev/null
@@ -1,796 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix toolchain-glibc
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-
-# Gentoo patchset
-PATCH_VER=2
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
-
-IUSE="audit caps debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
-
-# Min kernel version nptl requires
-: ${NPTL_KERN_VER:="2.6.32"}
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-"
-RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.9
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.9
-		virtual/os-headers
-	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# the phases
-#
-
-pkg_pretend() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-		# The high rev # is to allow people to downgrade between -r# versions.
-		# We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine.
-		# Hopefully we never actually use a r# this high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction"
-			die "Aborting to save your system"
-		fi
-
-		if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
-		then
-			eerror "Your patched vendor kernel is broken.  You need to get an"
-			eerror "update from whoever is providing the kernel to you."
-			eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227"
-			eerror "https://bugs.gentoo.org/262698"
-			die "Keeping your system alive, say thank you"
-		fi
-
-		if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
-		then
-			eerror "Your old kernel is broken.  You need to update it to"
-			eerror "a newer version as syscall(<bignum>) will break."
-			eerror "https://bugs.gentoo.org/279260"
-			die "Keeping your system alive, say thank you"
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	use hardened && ! tc-enables-pie && \
-		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
-
-	# Make sure host system is up to date #394453
-	if has_version '<sys-libs/glibc-2.13' && \
-	   [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]]
-	then
-		ebegin "Scanning system for __guard to see if you need to rebuild first ..."
-		local files=$(
-			scanelf -qys__guard -F'#s%F' \
-				"${EROOT}"/*bin/ \
-				"${EROOT}"/lib* \
-				"${EROOT}"/usr/*bin/ \
-				"${EROOT}"/usr/lib* | \
-				egrep -v \
-					-e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \
-					-e "^${EROOT}/sbin/(ldconfig|sln)$"
-		)
-		[[ -z ${files} ]]
-		if ! eend $? ; then
-			eerror "Your system still has old SSP __guard symbols.  You need to"
-			eerror "rebuild all the packages that provide these files first:"
-			eerror "${files}"
-			die "old __guard detected"
-		fi
-	fi
-}
-
-src_unpack() {
-	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	setup_env
-
-	# Check NPTL support _before_ we unpack things to save some time
-	check_nptl_support
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}"
-	touch locale/C-translit.h #185476 #218003
-
-	cd "${WORKDIR}"
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
-	# pull out all the addons
-	local d
-	for d in extra/*/configure ; do
-		d=${d%/configure}
-		[[ -d ${S}/${d} ]] && die "${d} already exists in \${S}"
-		mv "${d}" "${S}" || die "moving ${d} failed"
-	done
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER} ..."
-		eapply "${WORKDIR}"/patches
-		elog "Done."
-	fi
-
-	if just_headers ; then
-		if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
-			# mips peeps like to screw with us.  if building headers,
-			# we don't have a real compiler, so we can't let them
-			# insert -mabi on us.
-			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
-			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
-		fi
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-	fi
-}
-
-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 $1"
-
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS ; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-
-	# The glibc configure script doesn't properly use LDFLAGS all the time.
-	export CC="$(tc-getCC ${CTARGET}) ${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)"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	# set addons
-	pushd "${S}" > /dev/null
-	local addons=$(echo */configure | sed \
-		-e 's:/configure::g' \
-		-e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
-		-e 's: \+$::' \
-		-e 's! !,!g' \
-		-e 's!^!,!' \
-		-e '/^,\*$/d')
-	[[ -d ports ]] && addons+=",ports"
-	popd > /dev/null
-
-	case ${CTARGET} in
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=all )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	if [[ $1 == "nptl" ]] ; then
-		myconf+=( --enable-kernel=${NPTL_KERN_VER} )
-	else
-		die "invalid pthread option"
-	fi
-	myconf+=( --enable-add-ons="${addons#,}" )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(in_iuse systemtap && use_enable systemtap)
-		$(in_iuse nscd && use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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 "$1")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-			mkdir -p sunrpc
-			cp $(which rpcgen) sunrpc/cross-rpcgen || die
-			touch -t 202001010101 sunrpc/cross-rpcgen || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	local addons
-	[[ -d ${S}/ports ]] && addons+=",ports"
-	myconf+=( --enable-add-ons="${addons#,}" )
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	CC="$(tc-getBUILD_CC)" \
-	CFLAGS="-O1 -pipe" \
-	CPPFLAGS="-U_FORTIFY_SOURCE" \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir $1)"
-	emake -j1 check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test nptl
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally real_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Newer versions get fancy with libm linkage to include vectorized support.
-	# While we don't really need a ldscript here, portage QA checks get upset.
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		dosym ../../$(get_libdir)/libm-${upstream_pv}.so $(alt_usrlibdir)/libm-${upstream_pv}.so
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if in_iuse suid && ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		cd "${ED}"$(alt_libdir)/..
-		[[ -e lib ]] || mkdir lib
-		cd "${ED}"$(alt_usrlibdir)/..
-		[[ -e lib ]] || mkdir lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		elog "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		# if the host locales.gen contains no entries, we'll install everything
-		local locale_list="${EROOT}etc/locale.gen"
-		if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-			ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-			locale_list="${EROOT}usr/share/i18n/SUPPORTED"
-		fi
-		locale-gen -j $(makeopts_jobs) --config "${locale_list}"
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-11-12 14:16 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-11-12 14:16 UTC (permalink / raw
  To: gentoo-commits

commit:     02056778ea5961e77a59a7a246b355c1225c7404
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 12 12:28:38 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Nov 12 14:15:28 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=02056778

sys-libs/glibc: Re-add keywords to glibc 2.26

Bug: https://bugs.gentoo.org/492814
Bug: https://bugs.gentoo.org/622694
Bug: https://bugs.gentoo.org/617938
Bug: https://bugs.gentoo.org/466176
Bug: https://bugs.gentoo.org/628768
Bug: https://bugs.gentoo.org/637016
Bug: https://bugs.gentoo.org/636934
Bug: https://bugs.gentoo.org/381391
Bug: https://bugs.gentoo.org/636158
Package-Manager: Portage-2.3.13, Repoman-2.3.4

 sys-libs/glibc/glibc-2.26-r3.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r3.ebuild b/sys-libs/glibc/glibc-2.26-r3.ebuild
index e653041df34..2234b26a084 100644
--- a/sys-libs/glibc/glibc-2.26-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r3.ebuild
@@ -18,8 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-11-13 17:11 Manuel Rüger
  0 siblings, 0 replies; 1076+ messages in thread
From: Manuel Rüger @ 2017-11-13 17:11 UTC (permalink / raw
  To: gentoo-commits

commit:     194e20397e0f59dd15f17a4a2fa26f92e3eca3bc
Author:     Manuel Rüger <mrueg <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 13 17:11:14 2017 +0000
Commit:     Manuel Rüger <mrueg <AT> gentoo <DOT> org>
CommitDate: Mon Nov 13 17:11:14 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=194e2039

sys-libs/glibc: Stable on amd64

Package-Manager: Portage-2.3.12, Repoman-2.3.4

 sys-libs/glibc/glibc-2.25-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r9.ebuild b/sys-libs/glibc/glibc-2.25-r9.ebuild
index be7fea22eaa..3e0e1bdfed7 100644
--- a/sys-libs/glibc/glibc-2.25-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r9.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha ~amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh ~sparc x86"
+KEYWORDS="alpha amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh ~sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-11-13 23:26 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2017-11-13 23:26 UTC (permalink / raw
  To: gentoo-commits

commit:     66b10cf352d69a96824cba2c2a2bdea8e8094d7b
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 13 23:23:10 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon Nov 13 23:25:59 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=66b10cf3

sys-libs/glibc: guard against rendering system unusable, bug #627338

For cases like FEATURES=config-protect-if-modified
or custom /etc/nsswitch.conf with only 'compat' resolver
and external providers glibc upgrade will break local
user resolution when switching from older glibc.

Bad /etc/nsswitch.conf:
    passwd:      compat
    shadow:      compat
    group:       compat

Good /etc/nsswitch.conf:
    passwd:      files
    shadow:      files
    group:       files

Ok /etc/nsswitch.conf:
    passwd:     compat files
    shadow:     compat files
    group:      compat files

More up-to-date doc:
    https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26

Bug: https://bugs.gentoo.org/627338
Package-Manager: Portage-2.3.13, Repoman-2.3.4

 sys-libs/glibc/glibc-2.26-r3.ebuild | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.26-r3.ebuild b/sys-libs/glibc/glibc-2.26-r3.ebuild
index 2234b26a084..98ab050e12f 100644
--- a/sys-libs/glibc/glibc-2.26-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r3.ebuild
@@ -189,6 +189,21 @@ pkg_pretend() {
 			die "old __guard detected"
 		fi
 	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
 }
 
 src_unpack() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-11-14  9:00 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2017-11-14  9:00 UTC (permalink / raw
  To: gentoo-commits

commit:     c9076aa084c02f53cd7be9202738ed7337ff0c9c
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 14 09:00:25 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Nov 14 09:00:25 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c9076aa0

sys-libs/glibc: stable 2.25-r9 for hppa, bug #637140

Package-Manager: Portage-2.3.13, Repoman-2.3.4
RepoMan-Options: --include-arches="hppa"

 sys-libs/glibc/glibc-2.25-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r9.ebuild b/sys-libs/glibc/glibc-2.25-r9.ebuild
index 3e0e1bdfed7..ac362fe42e8 100644
--- a/sys-libs/glibc/glibc-2.25-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r9.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh ~sparc x86"
+KEYWORDS="alpha amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh ~sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-11-14  9:36 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2017-11-14  9:36 UTC (permalink / raw
  To: gentoo-commits

commit:     5d8d827255a5f831247dc838879c4582b46210c4
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 14 09:35:48 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Nov 14 09:35:48 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5d8d8272

sys-libs/glibc: added missing anchor to nsswitch.conf check, bug #627338

Original change meant to ignore lines starting with comment
but was missing leading like anchor. Added.

Reported-by: Dennis Schridde
Bug: https://bugs.gentoo.org/627338
Package-Manager: Portage-2.3.13, Repoman-2.3.4

 sys-libs/glibc/glibc-2.26-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r3.ebuild b/sys-libs/glibc/glibc-2.26-r3.ebuild
index 98ab050e12f..d66113063e9 100644
--- a/sys-libs/glibc/glibc-2.26-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r3.ebuild
@@ -194,7 +194,7 @@ pkg_pretend() {
 	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
 		local entry
 		for entry in passwd group shadow; do
-			if ! egrep -q "[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
 				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
 				eerror "Please make sure you have 'files' entries for"
 				eerror "'passwd:', 'group:' and 'shadow:' databases."


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-11-18 18:34 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-11-18 18:34 UTC (permalink / raw
  To: gentoo-commits

commit:     25fbe4af0a468fb23a53190fc590031928b54948
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 18 18:17:01 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Nov 18 18:34:30 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=25fbe4af

sys-libs/glibc: Forward-port safety checks to 9999

Commits
5d8d827255a5f831247dc838879c4582b46210c4
66b10cf352d69a96824cba2c2a2bdea8e8094d7b

Package-Manager: Portage-2.3.14, Repoman-2.3.6

 sys-libs/glibc/glibc-9999.ebuild | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 25412dcedbb..2be9e1d411d 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -196,6 +196,21 @@ pkg_pretend() {
 			die "old __guard detected"
 		fi
 	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
 }
 # todo: shouldn't most of these checks be called also in src_configure again?
 # (since consistency is not guaranteed between pkg_ and src_)


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-11-18 18:34 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-11-18 18:34 UTC (permalink / raw
  To: gentoo-commits

commit:     468d6930bad211f5744c1e41d99c496923bae677
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 18 18:34:12 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Nov 18 18:34:30 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=468d6930

sys-libs/glibc: Output fat warning if NIS is used and sys-auth/libnss-nis is not installed

Closes: https://bugs.gentoo.org/637946
Package-Manager: Portage-2.3.14, Repoman-2.3.6

 sys-libs/glibc/glibc-2.26-r3.ebuild | 15 +++++++++++++++
 sys-libs/glibc/glibc-9999.ebuild    | 15 +++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.26-r3.ebuild b/sys-libs/glibc/glibc-2.26-r3.ebuild
index d66113063e9..13aa5ad8bfb 100644
--- a/sys-libs/glibc/glibc-2.26-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r3.ebuild
@@ -800,4 +800,19 @@ pkg_postinst() {
 		fi
 		locale-gen -j $(makeopts_jobs) --config "${locale_list}"
 	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
 }

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2be9e1d411d..732d684a728 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -808,4 +808,19 @@ pkg_postinst() {
 
 		use compile-locales || run_locale_gen "${EROOT}"
 	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-11-18 20:50 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2017-11-18 20:50 UTC (permalink / raw
  To: gentoo-commits

commit:     9bda3ae1815f9d8eb3b2eb7924e932542a5f8273
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 18 20:50:35 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Nov 18 20:50:35 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9bda3ae1

sys-libs/glibc: stable 2.25-r9 for sparc, bug #637140 (thanks to Rolf Eike Beer)

Package-Manager: Portage-2.3.14, Repoman-2.3.6
RepoMan-Options: --include-arches="sparc"

 sys-libs/glibc/glibc-2.25-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r9.ebuild b/sys-libs/glibc/glibc-2.25-r9.ebuild
index ac362fe42e8..b8e8ec81073 100644
--- a/sys-libs/glibc/glibc-2.25-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r9.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh ~sparc x86"
+KEYWORDS="alpha amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-11-29  5:56 Markus Meier
  0 siblings, 0 replies; 1076+ messages in thread
From: Markus Meier @ 2017-11-29  5:56 UTC (permalink / raw
  To: gentoo-commits

commit:     629f0962875cfb8f04ca933deda87798b625c035
Author:     Markus Meier <maekke <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 29 05:51:44 2017 +0000
Commit:     Markus Meier <maekke <AT> gentoo <DOT> org>
CommitDate: Wed Nov 29 05:51:44 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=629f0962

sys-libs/glibc: arm stable, bug #637140

Package-Manager: Portage-2.3.13, Repoman-2.3.3
RepoMan-Options: --include-arches="arm"

 sys-libs/glibc/Manifest             | 42 ++++++++++++++++++-------------------
 sys-libs/glibc/glibc-2.25-r9.ebuild |  2 +-
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 8a2c0db1f9b..059f46ae53f 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -1,24 +1,24 @@
-DIST gcc-4.7.3-r1-multilib-bootstrap.tar.bz2 8064097 SHA256 34aec5a59bb4d0ecf908c62fd418461d0f3793238296897687305fd7a1f27299 SHA512 40b93e194ad41a75d649d84d1c49070680f253a13f0617803243bc61c44fed1ca2d0a7572a97ebb79353f312b58b5f6360be916dd7435928cc53935082e15269 WHIRLPOOL bbce19e7fe5c30faa55ddd4e29070f0d1fdfca3a04e8d68e0772260fa9be89ccde63ec92badb490209008df5fee6e53dfdeec4ae51857b90ba298a79315a199f
-DIST glibc-2.17-patches-8.tar.bz2 83707 SHA256 477946a4915dcd0cc0565ff8532d219e2ee868f6e821ea71ce579652d01ccbb3 SHA512 6675357e62b554d9d0f8ef70341b8038f8f89591fba384bc3783ef81aead0532486e2218af71da9c6f88a3b8b382edec81bed36eb636ee231eac80e111acbfd8 WHIRLPOOL 946f431b28ec60cc61d44364187f64a2d6e92ed7c9071126cf70277843c656de4dfac9f184f572f9a72c0cb452d879cdb7aca5b9f92f8ff02a8b1a521fffef43
-DIST glibc-2.17.tar.xz 10981956 SHA256 6914e337401e0e0ade23694e1b2c52a5f09e4eda3270c67e7c3ba93a89b5b23e SHA512 384e54037daaa344a26ce58242acc3f9a249d0765088d18a540a305745afa33ae6dec4024adae958eacd7100be9c713d117260ace8340f6d8c8396dbde4868d2 WHIRLPOOL 9b98c1c298aeff607aaa554341c300c15491b7314f127524fc5c048c67c5059daaf706e6cf206bb69213d5307e37bed87137ab46f504d8072bb778310081fc23
+DIST gcc-4.7.3-r1-multilib-bootstrap.tar.bz2 8064097 BLAKE2B 3cc5c82cd57d0fbd26d9a376ee8ca02f119fe9d653311cbe4d2b7b93aec2290adac3be271be19a7fdedae2e11e4b6e32360184e557204e100ad64357f5575d4b SHA512 40b93e194ad41a75d649d84d1c49070680f253a13f0617803243bc61c44fed1ca2d0a7572a97ebb79353f312b58b5f6360be916dd7435928cc53935082e15269
+DIST glibc-2.17-patches-8.tar.bz2 83707 BLAKE2B 134cd96eb0afa58f831b3a71acb5ffb2db223eb8450291e7cccf1afccda6f240283e63f1416e9775052010d1932d52b7a125a43b125d579945bb596575b679fa SHA512 6675357e62b554d9d0f8ef70341b8038f8f89591fba384bc3783ef81aead0532486e2218af71da9c6f88a3b8b382edec81bed36eb636ee231eac80e111acbfd8
+DIST glibc-2.17.tar.xz 10981956 BLAKE2B a8b2f190875619875bcd2f5c40d6c44628cbd4c3934fd4b60b54af33818052fc375a720344ffc2c52b55a62c1c23053793830b70a4b233a704ec1913e434a8b3 SHA512 384e54037daaa344a26ce58242acc3f9a249d0765088d18a540a305745afa33ae6dec4024adae958eacd7100be9c713d117260ace8340f6d8c8396dbde4868d2
 DIST glibc-2.18-patches-4.tar.bz2 95165 SHA256 89b458e22db60847b4ad869e3b5cf32868528b8d73205a692a6c0d07779dd083 SHA512 d881c9c5fe32b967694d4ca5185ff5ffc964449f2ed49fd062e5d57a3c6d9f16eef2f591d2d8e98a1a95a6487f3436ef031839ed8766fd085404b288340b7933 WHIRLPOOL 55f87d0efce1f84b45968f377e868c31102cb5228fe4ff1ffa132770f242f9f4f1843c28e4eb38ee7bed1321507ae12b7284a18199af63df1ecd070233d1076f
-DIST glibc-2.18.tar.xz 11150148 SHA256 2cb4e1e381928f1e5e55e71ab1ba8e0ea7ede75ff9709770435bfd018ea257a3 SHA512 27218d2e7dd3bf3908d7af171c490933680e958c579ebd27b43b661e223fd5de2219cc1cf699170405280808c84de476d0ad86dbba35a488ef404e9438552327 WHIRLPOOL 89b877c7db602ffd4374c7fb84db17397b91f889a7de6259f79374cc3fcd00613114cbb93feb518ef25fb2e579fb03843df15d17235c1fe1b6a7e0e64aa8e8fa
-DIST glibc-2.19-patches-3.tar.bz2 80664 SHA256 6fb03292e224199e0dd9ba7ee83aca723e1560f26831e85cdc6302b187c6de3c SHA512 d281d6a2757920124cf8a3f02b97e75192598b08d96ae48840df34c7ffdcb212952d171f233e6f12a429b19437d0a296212fe1f2eae164d6a1c6793cb3cb69f0 WHIRLPOOL 6f28a2d0dff42e8ad0e77859938e3093753f77f78821375777eebb2db5568bf1c56e8b8208f02280f23acb2dd26dc8a313fedd5b2c10755f1659e6d324a1dbc3
-DIST glibc-2.19.tar.xz 12083312 SHA256 2d3997f588401ea095a0b27227b1d50cdfdd416236f6567b564549d3b46ea2a2 SHA512 9e021fcb3afbb9ace2a0e37fded231a62de861bd766e29d47163a03182e37add718b7acc3963d1c525f9556773e842297725715acde48dcfbaab6e756af1a23d WHIRLPOOL 9581a3a23ebdd56bc559b56b95b7bcd21ca039546ec19c6c0e4e0738597542164fdb21ab1d1f36d5e73a205fb51f0974c7d497972615bce69ae002298f6475b6
-DIST glibc-2.20-patches-5.tar.bz2 55986 SHA256 3d3eec9ac9b5d0530f9e05614f4646d64ff93a48865b42c156990bea69247cda SHA512 409f59a028127e02f0c9f91107715b540d8d234475830adc17108a02664be232098d119b43bcc8df9b328ab50c1fffb0868d510e6487ce1c34ec2c7c7a78375b WHIRLPOOL b3c41b01af5d8ae8e901ac48ae124e13ff1c76fbeb35315cb9630c648c03d7abbfb753294cbdfe1dc939bda260e24d8450ffb19cfe5c255b32f8c5500f2c43f3
-DIST glibc-2.20.tar.xz 12283992 SHA256 f84b6d42aecc288d593c397b0a3d02260a33ee686bce0c634eb9b32798f36ba5 SHA512 7a8eea8b71d3ccba766c3f304cab61055446d451ef063309476b26dc40d880562dc33b1b68fbedeedb4b55b84c26415b9202311aaa71ef8c141b6849a814d2fa WHIRLPOOL 042f74d75c62a655ae35348c9cd0bed0845ab199e37a76635eb74c04ed927b5eca77723c38d2dc46f12fca62c1004001887b43946a914b079ad22f6a9cc8daaa
-DIST glibc-2.21-patches-7.tar.bz2 46894 SHA256 49126df6f4b819f2c315cca0a07e9b8ee7e279257148506d336ccfef5766bbcb SHA512 e4cca3d753c0b9d213c0ed85e3d08cbbf6517862b3a48af987e010abaf5a022b47330040ced183d30b5b934de7587e97b4342e51a6df3d5cfa768bdd8b43b756 WHIRLPOOL b5f4bffdcaf629d735e7498f509bf2130acb18194b18e69747bb6c3e403b221f2163eea3770bb19c05253d7134f70ed4657d7c30c5978f7b5571a3482f9521ad
-DIST glibc-2.21.tar.xz 12322092 SHA256 aeeb362437965a5d3f40b151094ca79def04a115bd363fdd4a9a0c69482923b8 SHA512 8cded6693618bec115f678fcbd0b77556f97dfa8337608f66e37224aefa55b38765ba61cb4d58beea37b5934e5ec8e30bad58613707388484906f2a0ce77997d WHIRLPOOL d07fec32bd92eade065a3b6170932b8bd41d07df4aa69dd5a860ebb9678c22bd1e20bf88b1fc05c3ecc18e709c0a63118e12525dc668e0399d7ef7fe4454702d
-DIST glibc-2.22-patches-13.tar.bz2 74479 SHA256 ffd1e0f9a41be030e5ce2518d9e84a1fbaa9a4fb2e96f1b85dafb05fea666c86 SHA512 73517fc1502b0733d67ade1d1ba6168415f5da64f37045fac0b10ef57155bf6dfbe1876e4742d2543fcea0c935c179426f6fbb94f0205968392ef903d2f83897 WHIRLPOOL 0eeedaf09eb42e5186256dd41aae00cd2b9b8e3ab929a792e83d0fd8e8a8630d829f01b293588bf59e105eb17ab512416d8d115c3e542cddc34a84b84d56af3d
-DIST glibc-2.22.tar.xz 12969072 SHA256 eb731406903befef1d8f878a46be75ef862b9056ab0cde1626d08a7a05328948 SHA512 a8719f3a4f8aa5fa81711116fdafbea5082c6dfd85bd8c4cdce60571910263ab422b35bb8b55a84d37ccb146442133ba60a84d453ca4a439c8ccd35419bd051b WHIRLPOOL f7e707b3776fc197a2e7bf5633721925507237b154bbc1f94b9fc303c87e6fc039ff0758da6ee55b4c1a0daaa87c6e594a6c96e7b00a7ba8ae98ee29918709a7
-DIST glibc-2.23-patches-7.tar.bz2 315221 SHA256 97ef9e370ce9b09d8e9b9f6239f7ef94dd837d29b7bfc1404438c63da1d534ac SHA512 c0d0cab0a370acef0b085b0ab09ce868425a12bbb371d0a9ff91dc83a74a0d8d3b541d10c44650b00b7cb155f8ac1f87764e6a6bd9d6bae8a9a904b4df1650ef WHIRLPOOL 128ea1a2eeaad3d95cdf1054d10232a34e8f88d10ed8907a67d9ff02734243d20b21595ca3698a4861d9c65e2a59aedbcf8e399bd1ed879dba1556ce2995ad9b
-DIST glibc-2.23-patches-8.tar.bz2 304199 SHA256 6110777176abfb8d287d82804d98e007c255db6040a1beca589a212772c90482 SHA512 470814bbbd9d4ee5fa2dd7570a2e14b0229723e373e801472856fd6c2f089499eddc300f69b49af8ba0edbdca583ee3ca521fdb5c642509717cafea0ad925fd2 WHIRLPOOL 1ef9a431d67d7669f34f7db21185d50ddd6dc82c549a9ff274f0b98454417f4098ee771bfe10073be12d3c153ee46ff36e40b46ecb31844ab09791ae29b49074
-DIST glibc-2.23.tar.xz 13455260 SHA256 94efeb00e4603c8546209cefb3e1a50a5315c86fa9b078b6fad758e187ce13e9 SHA512 b82953388cd028e174cb08f082557bbce0dad8b67b17d31b29f90102fd52a51e03d591448ecb64882a1c1d5303afffc7f6ede85cee4c784a9284fbc9b4ad26cf WHIRLPOOL 7c7e3bf55a89a04bac917b9ca5a1cbb1613f22c427d2766f114b5a36f9635856005b823852ef5d3b73462b577fe4e5865e68e7b64633d48a95fa1e5eaa831a71
+DIST glibc-2.18.tar.xz 11150148 BLAKE2B 7848a5a50abedbd17085e05b6f6835959adb5e55a424d95fa8a49eeec999a6dd81a9382db85ef7e852ef1d7743c5d312dccbf42024e95edf0e802eb32928dfe5 SHA512 27218d2e7dd3bf3908d7af171c490933680e958c579ebd27b43b661e223fd5de2219cc1cf699170405280808c84de476d0ad86dbba35a488ef404e9438552327
+DIST glibc-2.19-patches-3.tar.bz2 80664 BLAKE2B fb348c711941c1bd4dadd905e172dc4f239d8b63af1a1d14dcf4ec45c504bd47e10e9b24b38f9e01796016f2e97caeeb693213ae08147274ed0a4d9501293be0 SHA512 d281d6a2757920124cf8a3f02b97e75192598b08d96ae48840df34c7ffdcb212952d171f233e6f12a429b19437d0a296212fe1f2eae164d6a1c6793cb3cb69f0
+DIST glibc-2.19.tar.xz 12083312 BLAKE2B 9dc03346e0f0df4bf009a92d894b0a9f964ff92b7f4c9663cedf1cb6cf90435f28a15539d33791ecf43ee578fa4e26f916af0367651312ef8f9c1c38ce0dafa2 SHA512 9e021fcb3afbb9ace2a0e37fded231a62de861bd766e29d47163a03182e37add718b7acc3963d1c525f9556773e842297725715acde48dcfbaab6e756af1a23d
+DIST glibc-2.20-patches-5.tar.bz2 55986 BLAKE2B bad714bd088fb8759ee84d33f22c0bba01a78a401c54828dc413c7ac2a08ae53fba9b07280996e54091f2c918658bb502aeb45f734022c1ab36e1be215381324 SHA512 409f59a028127e02f0c9f91107715b540d8d234475830adc17108a02664be232098d119b43bcc8df9b328ab50c1fffb0868d510e6487ce1c34ec2c7c7a78375b
+DIST glibc-2.20.tar.xz 12283992 BLAKE2B f2db06a06e47942e9f5aaad5c4b603d63bb9a3ba624dc1c973e864d65cf893adb7568a18516c0b915b772d2ca30e95899a4d5c03ff9b3ad23e1e276a1d535f39 SHA512 7a8eea8b71d3ccba766c3f304cab61055446d451ef063309476b26dc40d880562dc33b1b68fbedeedb4b55b84c26415b9202311aaa71ef8c141b6849a814d2fa
+DIST glibc-2.21-patches-7.tar.bz2 46894 BLAKE2B 5a15a3a5ca515351d5d41baaa59ae6b6d1c353f1500c3b8dcd6da895119c89afee9ef6afaa1e7d617f2cf7b7504635e5733429f65847acaa63c0a7bf8233ee9c SHA512 e4cca3d753c0b9d213c0ed85e3d08cbbf6517862b3a48af987e010abaf5a022b47330040ced183d30b5b934de7587e97b4342e51a6df3d5cfa768bdd8b43b756
+DIST glibc-2.21.tar.xz 12322092 BLAKE2B 1ce2be09787138262b59b56235e20777459e99861c65694b96f63d7faf24da8655882dd23b39c28a8a2d338c50710f76e1e4dc39a3f4ce9736ef2cbf7f99ed5b SHA512 8cded6693618bec115f678fcbd0b77556f97dfa8337608f66e37224aefa55b38765ba61cb4d58beea37b5934e5ec8e30bad58613707388484906f2a0ce77997d
+DIST glibc-2.22-patches-13.tar.bz2 74479 BLAKE2B 1ab31614e8334508a63c842f503a395ff3ebeaa33d1890eab1d9e2985cb39064960053f2bbf99ec3bdec0ba5a80d259ca6b964fcaed9d99dcb6da84ddb8dd364 SHA512 73517fc1502b0733d67ade1d1ba6168415f5da64f37045fac0b10ef57155bf6dfbe1876e4742d2543fcea0c935c179426f6fbb94f0205968392ef903d2f83897
+DIST glibc-2.22.tar.xz 12969072 BLAKE2B 36a2e08cf4c5c9396c414fcf5cf5f32d0a78a61e06a1309fbc5f560bed7a7f25a084f5f5c1097014d0911239c710ac9c06f6b6d603238b9c928dd286ebd05bbf SHA512 a8719f3a4f8aa5fa81711116fdafbea5082c6dfd85bd8c4cdce60571910263ab422b35bb8b55a84d37ccb146442133ba60a84d453ca4a439c8ccd35419bd051b
+DIST glibc-2.23-patches-7.tar.bz2 315221 BLAKE2B 6872dff949e4293a2c5e58597433f0cef80a26011582a3b46a51b45135f6125764097890324bd2787241567e56e9eaabbf40b0faafd2590af4ede4789a965364 SHA512 c0d0cab0a370acef0b085b0ab09ce868425a12bbb371d0a9ff91dc83a74a0d8d3b541d10c44650b00b7cb155f8ac1f87764e6a6bd9d6bae8a9a904b4df1650ef
+DIST glibc-2.23-patches-8.tar.bz2 304199 BLAKE2B 693e40090dbe43f0e9c1faa0bce75e43d5d3924b40c141f9d00ef147fd285b03e2c3bab6a32d1bf6978ca139c3f071f685d5caf1bffb1cce7e1d1f3c346e5c50 SHA512 470814bbbd9d4ee5fa2dd7570a2e14b0229723e373e801472856fd6c2f089499eddc300f69b49af8ba0edbdca583ee3ca521fdb5c642509717cafea0ad925fd2
+DIST glibc-2.23.tar.xz 13455260 BLAKE2B 6658e9d2d07c5cd71be94ef399bfe4d18ef462e4154e2e02aa69c34198e881cc65ac8f89abcb37b3d01c56b10e2f47c036492c20e4991a54bd03e56db703fbd2 SHA512 b82953388cd028e174cb08f082557bbce0dad8b67b17d31b29f90102fd52a51e03d591448ecb64882a1c1d5303afffc7f6ede85cee4c784a9284fbc9b4ad26cf
 DIST glibc-2.24-patches-10.tar.bz2 73586 SHA256 d479033b63ff796fea56fb1bde390c442021acd856994b15c983b4a89e46fbbe SHA512 fc9191a85da53a2515bbaab228648936682e04267284049468e0c82284f618ab2907b9247baca701e16edc50640199ff6d8e2a6a93ccbd5a9d3b0eb73cc484ca WHIRLPOOL 7afe94307900a70de2f5e028d8ec9e0f4b06b661ec6493217e51a13d750f891e10b45c0f66d86fa83c16cc3ce539bb257039b33bc3e363469cd03502d956d75e
-DIST glibc-2.24.tar.xz 13554048 SHA256 99d4a3e8efd144d71488e478f62587578c0f4e1fa0b4eed47ee3d4975ebeb5d3 SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb WHIRLPOOL be82b47fc73f7e780e8e73a5f58b313d8e861d5ea8c4320f95ef0d8c1e125ff011d61dcfc0380be0e83868bd8c3299de1ea662da7fc8d709050e89b2c126e3eb
-DIST glibc-2.25-patches-11.tar.bz2 64221 SHA256 38c76c844238a7bbaecc85b359e67af6a98a1614f3196f25d85f83dec4358e99 SHA512 cbbbca9653f55f0cb3b73c38c979cb439c87b172819f3e999d2b435d59cd2bef2c89f11a398300c53f447ad433ee87f47a0f3e890c78f8694705c788455325dd WHIRLPOOL e61203ac129d7283f3beda1421e1365da58c229bcb6b6a1f8b71755d9ea0e2bfb64b8be69ab7698861a593d4b98ab6163d574f3c215fba0a0d9e6a1b15d2eed5
-DIST glibc-2.25-patches-12.tar.bz2 65396 SHA256 60a8901ceab4066661285cdbf7559d3a1f66bf468c5c1a5ecdde7f8ead282d3e SHA512 6af8c304ba70b42dfda294873d9a138d6c98e7a46496e305b2cac99a085d1ad3d00315162d1e1458e651de95e158bd35be74406a3f44fde13182e30baa663fcb WHIRLPOOL 96684d379d65ca6e4da7d397d4b803e0b0516080223de86080d6bbf3cae6a17b9fc8922d6fc2071b3116f35136378d85eb6671c7d9f7cf0f2135b66d1573bb90
-DIST glibc-2.25.tar.xz 13873900 SHA256 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e WHIRLPOOL dc2fafaa4a0e5581268338453838a03ed0c5e7a2af844e8fb7086ab8d3ae48efbdbe6f25db1d089ae669cd2f8b0412f690d965506753d86f8525da2df59b7953
-DIST glibc-2.26-patches-4.tar.bz2 315447 SHA256 2f49edd3a45bc5bb3c16f86228bfdeaba7e2b48b7eefad63e2ffa2ed3f6d628e SHA512 04d229e5f9342d62f2fce039c70489609886782d8aabd49403863a1a679e3b0890ca26c129088738a4af7ef6d95c74f24fb3c4d03695bf7ba6e45eca4de1a5f0 WHIRLPOOL 06b31af65b4f6092fa7b8776507cfdd014649670dae49c1d6a35ce61b3345d08acb9e09076a8cfe310ffe7d698d212310c8f497366c57240a463a31a39a175d9
-DIST glibc-2.26.tar.xz 14682748 SHA256 e54e0a934cd2bc94429be79da5e9385898d2306b9eaf3c92d5a77af96190f6bd SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0 WHIRLPOOL 9091c3bccc9b590de6b9595aa391ba01091f0c301bd9199d7c48fbeaeeb013ec9c683c68b65b59c5a69e3905b7f842cca1b0a410431967ecb3a1229b8535486f
+DIST glibc-2.24.tar.xz 13554048 BLAKE2B 9f93ac00f68eb88e3a2272752624163fac25dd064170e336143aa697908fba2b27ed926582f978da99c6c2489c0ce34d3eb266b5d00be69d27b36126bc2c8efb SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb
+DIST glibc-2.25-patches-11.tar.bz2 64221 BLAKE2B 13dd8ec797ad11a8d8d4b7a1057ecfe3402988513fed4a442bf50229aaba344d574f54a70a2ceaf53e2537c5f16fdc57905060dc9f27224b8f23e88521adec5e SHA512 cbbbca9653f55f0cb3b73c38c979cb439c87b172819f3e999d2b435d59cd2bef2c89f11a398300c53f447ad433ee87f47a0f3e890c78f8694705c788455325dd
+DIST glibc-2.25-patches-12.tar.bz2 65396 BLAKE2B b23d5d681314c03b8dd5ad20516324c1ce5b24deb4d9ce03970dce97b524ee9d3f5d5463f2d6b7693e4c9ef25d006847f960993f55ca082fc961268d05f937ca SHA512 6af8c304ba70b42dfda294873d9a138d6c98e7a46496e305b2cac99a085d1ad3d00315162d1e1458e651de95e158bd35be74406a3f44fde13182e30baa663fcb
+DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
+DIST glibc-2.26-patches-4.tar.bz2 315447 BLAKE2B 038926c8c187cfea5c00a7017a486356adf0f0959dc8868847f26877b4b441bd76629f20d52967f9da878f69a1ac2859332ed3984b4ebb5cb528d50e0b012736 SHA512 04d229e5f9342d62f2fce039c70489609886782d8aabd49403863a1a679e3b0890ca26c129088738a4af7ef6d95c74f24fb3c4d03695bf7ba6e45eca4de1a5f0
+DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
 DIST glibc-9999-patches-3.tar.bz2 19892 SHA256 97f60ed6debd495610b123d7a27227e75942bea1a0fb1e5f78833a6f3bbe6c64 SHA512 75084b86a83d447d3a4b3959fa2a93d849e304ba9473ebec5570ca4fb5e2f8dfb38548faf3abc9fbd29b529f2c608b52eb2ef2e6e9a2ad5bea9a9298a19ef596 WHIRLPOOL 04a5c30aabf72530fa96fa3a8eadf8207d85d3a2a948ba5f4b72c0deeeae24e7eb71b99875f0e9b1018051fabb4a23630b41873fa4ff0d6ba9778ca6051212bf

diff --git a/sys-libs/glibc/glibc-2.25-r9.ebuild b/sys-libs/glibc/glibc-2.25-r9.ebuild
index b8e8ec81073..a82ae2ce8f5 100644
--- a/sys-libs/glibc/glibc-2.25-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r9.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
+KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-12-02 16:36 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-12-02 16:36 UTC (permalink / raw
  To: gentoo-commits

commit:     cdeeef2c38cdb2ddd66fbc1fbce2b5af97f09c82
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Dec  2 16:36:16 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Dec  2 16:36:36 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cdeeef2c

sys-libs/glibc: Update NPTL_KERN_VER to 3.2 (minimum required by glibc-2.26)

The entire kernel version check needs rework (but that's something for >2.26).
Closes: https://bugs.gentoo.org/639152
Package-Manager: Portage-2.3.16, Repoman-2.3.6

 sys-libs/glibc/Manifest             | 2 +-
 sys-libs/glibc/glibc-2.26-r3.ebuild | 4 ++--
 sys-libs/glibc/glibc-9999.ebuild    | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 9639f2ede6d..74e080de5de 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,4 +17,4 @@ DIST glibc-2.25-patches-12.tar.bz2 65396 BLAKE2B b23d5d681314c03b8dd5ad20516324c
 DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
 DIST glibc-2.26-patches-4.tar.bz2 315447 BLAKE2B 038926c8c187cfea5c00a7017a486356adf0f0959dc8868847f26877b4b441bd76629f20d52967f9da878f69a1ac2859332ed3984b4ebb5cb528d50e0b012736 SHA512 04d229e5f9342d62f2fce039c70489609886782d8aabd49403863a1a679e3b0890ca26c129088738a4af7ef6d95c74f24fb3c4d03695bf7ba6e45eca4de1a5f0
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
-DIST glibc-9999-patches-3.tar.bz2 19892 SHA256 97f60ed6debd495610b123d7a27227e75942bea1a0fb1e5f78833a6f3bbe6c64 SHA512 75084b86a83d447d3a4b3959fa2a93d849e304ba9473ebec5570ca4fb5e2f8dfb38548faf3abc9fbd29b529f2c608b52eb2ef2e6e9a2ad5bea9a9298a19ef596 WHIRLPOOL 04a5c30aabf72530fa96fa3a8eadf8207d85d3a2a948ba5f4b72c0deeeae24e7eb71b99875f0e9b1018051fabb4a23630b41873fa4ff0d6ba9778ca6051212bf
+DIST glibc-9999-patches-3.tar.bz2 19892 BLAKE2B e0a51f376e7142f56ae2a0862a7723343ee378275c1a0c6c3a69607b5bb7f9bd655f0a68f8f9cfc32008e06852d0eb0a9e16c85ea9a395dc36b428f1ea6100d8 SHA512 75084b86a83d447d3a4b3959fa2a93d849e304ba9473ebec5570ca4fb5e2f8dfb38548faf3abc9fbd29b529f2c608b52eb2ef2e6e9a2ad5bea9a9298a19ef596

diff --git a/sys-libs/glibc/glibc-2.26-r3.ebuild b/sys-libs/glibc/glibc-2.26-r3.ebuild
index 13aa5ad8bfb..c2f06079940 100644
--- a/sys-libs/glibc/glibc-2.26-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r3.ebuild
@@ -34,8 +34,8 @@ SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOO
 
 IUSE="audit caps debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
 
-# Min kernel version nptl requires
-: ${NPTL_KERN_VER:="2.6.32"}
+# Min kernel version glibc requires
+: ${NPTL_KERN_VER:="3.2.0"}
 
 # Here's how the cross-compile logic breaks down ...
 #  CTARGET - machine that will target the binaries

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 732d684a728..60b17cfe67b 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -35,8 +35,8 @@ SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOO
 
 IUSE="audit caps compile-locales debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
 
-# Min kernel version nptl requires
-: ${NPTL_KERN_VER:="2.6.32"}
+# Min kernel version glibc requires
+: ${NPTL_KERN_VER:="3.2.0"}
 
 # Here's how the cross-compile logic breaks down ...
 #  CTARGET - machine that will target the binaries


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-12-15 21:57 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-12-15 21:57 UTC (permalink / raw
  To: gentoo-commits

commit:     5c3844421221d5f61665773f9f6f3497764609c8
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 15 21:57:10 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Dec 15 21:57:37 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5c384442

sys-libs/glibc: Fix useflag rpc description, disabling should no longer be experimental

Bug: https://bugs.gentoo.org/636934
Package-Manager: Portage-2.3.18, Repoman-2.3.6

 sys-libs/glibc/metadata.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index b32c212616a..a9538704369 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -10,7 +10,7 @@
  <flag name="debug">When USE=hardened, allow fortify/stack violations to dump core (SIGABRT) and not kill self (SIGKILL)</flag>
  <flag name="gd">build memusage and memusagestat tools</flag>
  <flag name="nscd">Build, and enable support for, the Name Service Cache Daemon</flag>
- <flag name="rpc">Enable obsolete RPC/NIS layers (disabling is experimental -- see bug 381391)</flag>
+ <flag name="rpc">Enable obsolete RPC/NIS layers</flag>
  <flag name="suid">Make internal pt_chown helper setuid -- not needed if using Linux and have /dev/pts mounted with gid=5</flag>
  <flag name="systemtap">enable systemtap static probe points</flag>
 </use>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-12-16 19:04 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-12-16 19:04 UTC (permalink / raw
  To: gentoo-commits

commit:     e35ef2d25fd6bc46a3289f4c39667727c32e1eea
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 16 19:03:53 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Dec 16 19:04:12 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e35ef2d2

sys-libs/glibc: Downgrade hosts.conf message to einfo, bug 638154

The logic of the setting makes sense though...

Bug: https://bugs.gentoo.org/436530
Closes: https://bugs.gentoo.org/638154
Package-Manager: Portage-2.3.18, Repoman-2.3.6

 sys-libs/glibc/glibc-2.26-r3.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r3.ebuild b/sys-libs/glibc/glibc-2.26-r3.ebuild
index 0edb97902c8..88a9cd4b5b3 100644
--- a/sys-libs/glibc/glibc-2.26-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r3.ebuild
@@ -775,7 +775,7 @@ pkg_preinst() {
 	# Default /etc/hosts.conf:multi to on for systems with small dbs.
 	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
 		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		elog "Defaulting /etc/host.conf:multi to on"
+		einfo "Defaulting /etc/host.conf:multi to on"
 	fi
 
 	[[ ${ROOT} != "/" ]] && return 0

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index e29a0778fd5..a3b427221e2 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -789,7 +789,7 @@ pkg_preinst() {
 	# Default /etc/hosts.conf:multi to on for systems with small dbs.
 	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
 		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		elog "Defaulting /etc/host.conf:multi to on"
+		einfo "Defaulting /etc/host.conf:multi to on"
 	fi
 
 	[[ ${ROOT} != "/" ]] && return 0


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-12-17 22:27 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-12-17 22:27 UTC (permalink / raw
  To: gentoo-commits

commit:     abbc4ee764485b39ca6e9861fc3f54b4c793a99b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 17 22:26:52 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Dec 17 22:27:11 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=abbc4ee7

sys-libs/glibc: Add useflag doc; controlls installation of manual and dependency on texinfo, bug 616190

Closes: https://bugs.gentoo.org/616190
Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-2.26-r3.ebuild | 11 +++++++++--
 sys-libs/glibc/glibc-9999.ebuild    | 11 +++++++++--
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r3.ebuild b/sys-libs/glibc/glibc-2.26-r3.ebuild
index 88a9cd4b5b3..ceb5b684685 100644
--- a/sys-libs/glibc/glibc-2.26-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r3.ebuild
@@ -32,7 +32,7 @@ PATCH_VER=4
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
 
-IUSE="audit caps debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+IUSE="audit caps debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
 
 # Min kernel version glibc requires
 : ${NPTL_KERN_VER:="3.2.0"}
@@ -80,6 +80,7 @@ DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
 	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2
+	doc? ( sys-apps/texinfo )
 "
 RDEPEND="${COMMON_DEPEND}
 	!sys-kernel/ps3-sources
@@ -286,8 +287,14 @@ glibc_do_configure() {
 
 	einfo "Configuring glibc for $1"
 
+	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 ; do
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO ; do
 		einfo " $(printf '%15s' ${v}:)   ${!v}"
 	done
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a3b427221e2..68d17a22469 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -33,7 +33,7 @@ PATCH_VER="3"
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
 
-IUSE="audit caps compile-locales debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+IUSE="audit caps compile-locales debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
 
 # Min kernel version glibc requires
 : ${NPTL_KERN_VER:="3.2.0"}
@@ -85,6 +85,7 @@ DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
 	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2
+	doc? ( sys-apps/texinfo )
 "
 RDEPEND="${COMMON_DEPEND}
 	!sys-kernel/ps3-sources
@@ -298,8 +299,14 @@ glibc_do_configure() {
 
 	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 ; do
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO ; do
 		einfo " $(printf '%15s' ${v}:)   ${!v}"
 	done
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-12-20 12:37 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2017-12-20 12:37 UTC (permalink / raw
  To: gentoo-commits

commit:     2094540085135ecf4ec79d9cd9bb2df598d8083b
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 20 12:37:04 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Dec 20 12:37:21 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=20945400

sys-libs/glibc: enable IFUNC support only on whitelisted ARCHes, bug #641216

Apply commit ac450135f29ef850303589af998373d936955476 to -9999 as well.
("sys-libs/glibc: enable IFUNC support only on whitelisted ARCHes, bug #641216")

Reported-by: Émeric Maschino
Bug: https://sourceware.org/PR22634
Closes: https://bugs.gentoo.org/641216
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-9999.ebuild | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 68d17a22469..a5bf3b51ebc 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -342,6 +342,17 @@ glibc_do_configure() {
 	esac
 	myconf+=( --enable-stackguard-randomization )
 
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
 	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
 
 	myconf+=( --enable-kernel=${NPTL_KERN_VER} )


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-12-21 21:02 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2017-12-21 21:02 UTC (permalink / raw
  To: gentoo-commits

commit:     a397860fe4368ec2e497135f4c0941a3011ee5fd
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 21 21:01:26 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Dec 21 21:01:48 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a397860f

sys-libs/glibc: Unkeyworded, untested patchset/revision bumps

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/Manifest              |   2 +
 sys-libs/glibc/glibc-2.25-r10.ebuild | 153 +++++++
 sys-libs/glibc/glibc-2.26-r4.ebuild  | 842 +++++++++++++++++++++++++++++++++++
 3 files changed, 997 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index f5363b30348..3e03ec26dbb 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,7 +14,9 @@ DIST glibc-2.23.tar.xz 13455260 BLAKE2B 6658e9d2d07c5cd71be94ef399bfe4d18ef462e4
 DIST glibc-2.24-patches-10.tar.bz2 73586 BLAKE2B f42cc78b907e7cb5c8ba1672c845cdc0959f4d29f89ff642bd2efa795d7ac69409b514338ac1f4235ce2fbc0c9c9bb2d152f55fd14c02997517dc048a306e1c1 SHA512 fc9191a85da53a2515bbaab228648936682e04267284049468e0c82284f618ab2907b9247baca701e16edc50640199ff6d8e2a6a93ccbd5a9d3b0eb73cc484ca
 DIST glibc-2.24.tar.xz 13554048 BLAKE2B 9f93ac00f68eb88e3a2272752624163fac25dd064170e336143aa697908fba2b27ed926582f978da99c6c2489c0ce34d3eb266b5d00be69d27b36126bc2c8efb SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb
 DIST glibc-2.25-patches-12.tar.bz2 65396 BLAKE2B b23d5d681314c03b8dd5ad20516324c1ce5b24deb4d9ce03970dce97b524ee9d3f5d5463f2d6b7693e4c9ef25d006847f960993f55ca082fc961268d05f937ca SHA512 6af8c304ba70b42dfda294873d9a138d6c98e7a46496e305b2cac99a085d1ad3d00315162d1e1458e651de95e158bd35be74406a3f44fde13182e30baa663fcb
+DIST glibc-2.25-patches-13.tar.bz2 71481 BLAKE2B bf5691afabf03b579b8d634da30a2a967ab62d5e470a23b0946ff3354aa974b3b65821aca2f33dd30dd864a82459f4750178bf6ae01a5117ccfde62efd8f594e SHA512 7c80e4aba9edf0310e1707b03a6945f657d71267a4d0d67c24b979c841544a6a623d7c2dbb0a0d55863e25831439d717d096ecf377f936b731baeb04f21704a7
 DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
 DIST glibc-2.26-patches-4.tar.bz2 315447 BLAKE2B 038926c8c187cfea5c00a7017a486356adf0f0959dc8868847f26877b4b441bd76629f20d52967f9da878f69a1ac2859332ed3984b4ebb5cb528d50e0b012736 SHA512 04d229e5f9342d62f2fce039c70489609886782d8aabd49403863a1a679e3b0890ca26c129088738a4af7ef6d95c74f24fb3c4d03695bf7ba6e45eca4de1a5f0
+DIST glibc-2.26-patches-5.tar.bz2 357699 BLAKE2B 98a0cb231bf35a132747f1fa6e654a9ad2eff8b445f002a0239c9a45f5a896ad490570aedee2b43e6cfa94794ae5c8b5e312e369838c3770823f28b61b51b592 SHA512 0040469e4a85f5c2aac972e42aeb06b0adfc3a132b32b19306be9f1877339fe6651a2fbd4d90d502b07ae4460f74efbd1cd103d38a2038df9402b0a380f03c2a
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
 DIST glibc-9999-patches-3.tar.bz2 19892 BLAKE2B e0a51f376e7142f56ae2a0862a7723343ee378275c1a0c6c3a69607b5bb7f9bd655f0a68f8f9cfc32008e06852d0eb0a9e16c85ea9a395dc36b428f1ea6100d8 SHA512 75084b86a83d447d3a4b3959fa2a93d849e304ba9473ebec5570ca4fb5e2f8dfb38548faf3abc9fbd29b529f2c608b52eb2ef2e6e9a2ad5bea9a9298a19ef596

diff --git a/sys-libs/glibc/glibc-2.25-r10.ebuild b/sys-libs/glibc/glibc-2.25-r10.ebuild
new file mode 100644
index 00000000000..e8d62b3ad2d
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.25-r10.ebuild
@@ -0,0 +1,153 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit toolchain-glibc
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+KEYWORDS=""
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+case ${PV} in
+9999*)
+	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+	EGIT_SOURCEDIRS="${S}"
+	inherit git-2
+	;;
+*)
+	RELEASE_VER=${PV}
+	;;
+esac
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
+PATCH_VER="13"                                  # Gentoo patchset
+: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
+
+GLIBC_PATCH_EXCLUDE+=" 0005_all_sys-types.h-drop-sys-sysmacros.h-include.patch"
+
+IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2"
+RDEPEND="${COMMON_DEPEND}
+	!sys-kernel/ps3-sources
+	sys-apps/gentoo-functions
+	!sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !crosscompile_opts_headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.7
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.7
+		virtual/os-headers"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+	local devspace="HTTP~vapier/dist/URI HTTP~dilfridge/distfiles/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
+	devspace=${devspace//HTTP/https://dev.gentoo.org/}
+	echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+src_unpack() {
+	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+
+	toolchain-glibc_src_unpack
+}
+
+src_prepare() {
+	toolchain-glibc_src_prepare
+
+	cd "${S}"
+
+	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
+
+	if use hardened ; then
+		# We don't enable these for non-hardened as the output is very terse --
+		# it only states that a crash happened.  The default upstream behavior
+		# includes backtraces and symbols.
+		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
+
+		if use debug ; then
+			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+			sed -i \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				debug/Makefile || die
+		fi
+	fi
+
+	case $(gcc-fullversion) in
+	4.8.[0-3]|4.9.0)
+		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
+		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
+		die "need to switch compilers #547420"
+		;;
+	esac
+}

diff --git a/sys-libs/glibc/glibc-2.26-r4.ebuild b/sys-libs/glibc/glibc-2.26-r4.ebuild
new file mode 100644
index 00000000000..97cf7ef1cbc
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.26-r4.ebuild
@@ -0,0 +1,842 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit prefix toolchain-glibc
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+
+# Gentoo patchset
+PATCH_VER=5
+
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
+
+IUSE="audit caps debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Min kernel version glibc requires
+: ${NPTL_KERN_VER:="3.2.0"}
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	doc? ( sys-apps/texinfo )
+"
+RDEPEND="${COMMON_DEPEND}
+	!sys-kernel/ps3-sources
+	sys-apps/gentoo-functions
+	!sys-libs/nss-db
+"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !crosscompile_opts_headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.9
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.9
+		virtual/os-headers
+	"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# the phases
+#
+
+pkg_pretend() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ ${ROOT} == "/" ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+		# The high rev # is to allow people to downgrade between -r# versions.
+		# We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine.
+		# Hopefully we never actually use a r# this high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction"
+			die "Aborting to save your system"
+		fi
+
+		if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
+		then
+			eerror "Your patched vendor kernel is broken.  You need to get an"
+			eerror "update from whoever is providing the kernel to you."
+			eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227"
+			eerror "https://bugs.gentoo.org/262698"
+			die "Keeping your system alive, say thank you"
+		fi
+
+		if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
+		then
+			eerror "Your old kernel is broken.  You need to update it to"
+			eerror "a newer version as syscall(<bignum>) will break."
+			eerror "https://bugs.gentoo.org/279260"
+			die "Keeping your system alive, say thank you"
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	use hardened && ! tc-enables-pie && \
+		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
+
+	# Make sure host system is up to date #394453
+	if has_version '<sys-libs/glibc-2.13' && \
+	   [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]]
+	then
+		ebegin "Scanning system for __guard to see if you need to rebuild first ..."
+		local files=$(
+			scanelf -qys__guard -F'#s%F' \
+				"${EROOT}"/*bin/ \
+				"${EROOT}"/lib* \
+				"${EROOT}"/usr/*bin/ \
+				"${EROOT}"/usr/lib* | \
+				egrep -v \
+					-e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \
+					-e "^${EROOT}/sbin/(ldconfig|sln)$"
+		)
+		[[ -z ${files} ]]
+		if ! eend $? ; then
+			eerror "Your system still has old SSP __guard symbols.  You need to"
+			eerror "rebuild all the packages that provide these files first:"
+			eerror "${files}"
+			die "old __guard detected"
+		fi
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+}
+
+src_unpack() {
+	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+
+	setup_env
+
+	# Check NPTL support _before_ we unpack things to save some time
+	check_nptl_support
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${S}"
+	touch locale/C-translit.h #185476 #218003
+
+	cd "${WORKDIR}"
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	if just_headers ; then
+		if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
+			# mips peeps like to screw with us.  if building headers,
+			# we don't have a real compiler, so we can't let them
+			# insert -mabi on us.
+			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
+			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
+		fi
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+
+	if use hardened ; then
+		# We don't enable these for non-hardened as the output is very terse --
+		# it only states that a crash happened.  The default upstream behavior
+		# includes backtraces and symbols.
+		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
+
+		if use debug ; then
+			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+			sed -i \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				debug/Makefile || die
+		fi
+	fi
+}
+
+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 $1"
+
+	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 ; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+
+	# The glibc configure script doesn't properly use LDFLAGS all the time.
+	export CC="$(tc-getCC ${CTARGET}) ${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)"
+	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
+
+	echo
+
+	local myconf=()
+
+	# set addons
+	pushd "${S}" > /dev/null
+	local addons=$(echo */configure | sed \
+		-e 's:/configure::g' \
+		-e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
+		-e 's: \+$::' \
+		-e 's! !,!g' \
+		-e 's!^!,!' \
+		-e '/^,\*$/d')
+	[[ -d ports ]] && addons+=",ports"
+	popd > /dev/null
+
+	case ${CTARGET} in
+		mips*)
+			# dlopen() detects stack smash on mips n32 ABI.
+			# Cause is unknown: https://bugs.gentoo.org/640130
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=all )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	if [[ $1 == "nptl" ]] ; then
+		myconf+=( --enable-kernel=${NPTL_KERN_VER} )
+	else
+		die "invalid pthread option"
+	fi
+	myconf+=( --enable-add-ons="${addons#,}" )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		--sysconfdir="${EPREFIX}/etc"
+		--localstatedir="${EPREFIX}/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(in_iuse systemtap && use_enable systemtap)
+		$(in_iuse nscd && use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="${EPREFIX}/sbin"
+	export libc_cv_slibdir="${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 "$1")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+			mkdir -p sunrpc
+			cp $(which rpcgen) sunrpc/cross-rpcgen || die
+			touch -t 202001010101 sunrpc/cross-rpcgen || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		${EXTRA_ECONF}
+	)
+
+	local addons
+	[[ -d ${S}/ports ]] && addons+=",ports"
+	myconf+=( --enable-add-ons="${addons#,}" )
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	CC="$(tc-getBUILD_CC)" \
+	CFLAGS="-O1 -pipe" \
+	CPPFLAGS="-U_FORTIFY_SOURCE" \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir $1)"
+	emake -j1 check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test nptl
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}$(alt_prefix)" install || die
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally real_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Newer versions get fancy with libm linkage to include vectorized support.
+	# While we don't really need a ldscript here, portage QA checks get upset.
+	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		dosym ../../$(get_libdir)/libm-${upstream_pv}.so $(alt_usrlibdir)/libm-${upstream_pv}.so
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if in_iuse suid && ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		cd "${ED}"$(alt_libdir)/..
+		[[ -e lib ]] || mkdir lib
+		cd "${ED}"$(alt_usrlibdir)/..
+		[[ -e lib ]] || mkdir lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+	src_strip
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ ${ROOT} != "/" ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+	fi
+
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		# if the host locales.gen contains no entries, we'll install everything
+		local locale_list="${EROOT}etc/locale.gen"
+		if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+			ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+			locale_list="${EROOT}usr/share/i18n/SUPPORTED"
+		fi
+		locale-gen -j $(makeopts_jobs) --config "${locale_list}"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-12-24  9:46 Mart Raudsepp
  0 siblings, 0 replies; 1076+ messages in thread
From: Mart Raudsepp @ 2017-12-24  9:46 UTC (permalink / raw
  To: gentoo-commits

commit:     fb3ef141184b8ad96f90a9745d9f42bbfcf9faa8
Author:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 24 09:16:37 2017 +0000
Commit:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
CommitDate: Sun Dec 24 09:16:37 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fb3ef141

sys-libs/glibc-2.25-r9: arm64 stable

Package-Manager: Portage-2.3.19, Repoman-2.3.6
RepoMan-Options: --include-arches="arm64"

 sys-libs/glibc/glibc-2.25-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r9.ebuild b/sys-libs/glibc/glibc-2.25-r9.ebuild
index a82ae2ce8f5..62c5c1ac0cf 100644
--- a/sys-libs/glibc/glibc-2.25-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r9.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2017-12-31 21:26 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2017-12-31 21:26 UTC (permalink / raw
  To: gentoo-commits

commit:     0e95698ff9584aa8045275705c0247a77264d044
Author:     Matija Skala <mskala <AT> gmx <DOT> com>
AuthorDate: Thu Nov  9 16:49:37 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Dec 31 21:26:29 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0e95698f

sys-libs/glibc: avoid libm-2.26.so symlink clash on merged /usr, bug #627378

The problem in bug #627378 manifests as libm-2.26.so file corruption:

Before the change glibc package contained a 'libm-2.26.so'
symlink from '/usr/lib64' to '/lib64':

    $ equery f sys-libs/glibc | sed 's@usr/lib@lib@g' | sort | uniq -d
    /lib64/libm-2.26.so

When both are the same directory all depends on the merge order:
- symlink first, then real file. real file overwrites symlink, all is good
- real file first, then symlink. symlink overwrites the file and points to
  itself. Binaries linked against libm fail to start.

The change is to get rid of symlink (symlink was a workaround to portage's
QA check) and move 'libm-2.26.a' from '/usr/lib64' to '/usr/lib64/glibc-<pv>'.

Reported-by: Duncan
Fixed-by: Matija Skala
Closes: https://bugs.gentoo.org/627378
Closes: https://github.com/gentoo/gentoo/pull/4268

 sys-libs/glibc/{glibc-2.26-r4.ebuild => glibc-2.26-r5.ebuild} | 11 +++++++----
 sys-libs/glibc/glibc-9999.ebuild                              | 11 +++++++----
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r4.ebuild b/sys-libs/glibc/glibc-2.26-r5.ebuild
similarity index 97%
rename from sys-libs/glibc/glibc-2.26-r4.ebuild
rename to sys-libs/glibc/glibc-2.26-r5.ebuild
index 97cf7ef1cbc..abde9e62f95 100644
--- a/sys-libs/glibc/glibc-2.26-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r5.ebuild
@@ -607,15 +607,18 @@ glibc_do_src_install() {
 	find "${D}" -name "libnsl.a" -delete
 	find "${D}" -name "libnsl.so" -delete
 
-	# Normally real_pv is ${PV}. Live ebuilds are exception, there we need
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
 	# to infer upstream version:
 	# '#define VERSION "2.26.90"' -> '2.26.90'
 	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
 
-	# Newer versions get fancy with libm linkage to include vectorized support.
-	# While we don't really need a ldscript here, portage QA checks get upset.
 	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		dosym ../../$(get_libdir)/libm-${upstream_pv}.so $(alt_usrlibdir)/libm-${upstream_pv}.so
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
 	fi
 
 	# We'll take care of the cache ourselves

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a5bf3b51ebc..2aed938db02 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -614,15 +614,18 @@ glibc_do_src_install() {
 	find "${D}" -name "libnsl.a" -delete
 	find "${D}" -name "libnsl.so" -delete
 
-	# Normally real_pv is ${PV}. Live ebuilds are exception, there we need
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
 	# to infer upstream version:
 	# '#define VERSION "2.26.90"' -> '2.26.90'
 	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
 
-	# Newer versions get fancy with libm linkage to include vectorized support.
-	# While we don't really need a ldscript here, portage QA checks get upset.
 	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		dosym ../../$(get_libdir)/libm-${upstream_pv}.so $(alt_usrlibdir)/libm-${upstream_pv}.so
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
 	fi
 
 	# We'll take care of the cache ourselves


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-01 15:10 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-01-01 15:10 UTC (permalink / raw
  To: gentoo-commits

commit:     7d670bcd5943bdb4642bc4c1e37672a048d70e14
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  1 15:09:44 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jan  1 15:10:01 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7d670bcd

sys-libs/glibc: Restore keywords of 2.26-r5

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-2.26-r5.ebuild | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r5.ebuild b/sys-libs/glibc/glibc-2.26-r5.ebuild
index abde9e62f95..c5a076afbdb 100644
--- a/sys-libs/glibc/glibc-2.26-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r5.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -18,8 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-03 10:47 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-01-03 10:47 UTC (permalink / raw
  To: gentoo-commits

commit:     a174af78adc703f0acda31c66e196cefd02bd2e6
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  3 10:46:37 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jan  3 10:47:05 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a174af78

sys-libs/glibc: Restore keywords in 2.25-r10

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-2.25-r10.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.25-r10.ebuild b/sys-libs/glibc/glibc-2.25-r10.ebuild
index e8d62b3ad2d..71709c387e7 100644
--- a/sys-libs/glibc/glibc-2.25-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r10.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="5"
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS=""
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-07 19:39 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-01-07 19:39 UTC (permalink / raw
  To: gentoo-commits

commit:     91a02442c5a6c157bf9de58b20d327c88e9fac20
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  7 18:43:58 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jan  7 19:39:44 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=91a02442

sys-libs/glibc: Migrate CROSSCOMPILE_OPTS=headers-only -> USE=headers-only

CROSSCOMPILE_OPTS is a USE_EXPAND of a single item: headers-only.
Convert it to a global USE flag instead.

Mechanical ebuild rename done as:
    $ sed -e 's@crosscompile_opts_headers-only@headers-only@g' \
        -i $(git grep -l headers-only)

'headers-only' flag is used by crossdev to bootstrap stage1 compiler
before libc is available.

crossdev switched to USE=headers-only in =sys-devel/crossdev-20171230.

Bug: https://bugs.gentoo.org/642712
Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-2.18-r1.ebuild  | 6 +++---
 sys-libs/glibc/glibc-2.19-r1.ebuild  | 6 +++---
 sys-libs/glibc/glibc-2.20-r2.ebuild  | 6 +++---
 sys-libs/glibc/glibc-2.21-r2.ebuild  | 6 +++---
 sys-libs/glibc/glibc-2.22-r4.ebuild  | 6 +++---
 sys-libs/glibc/glibc-2.23-r4.ebuild  | 6 +++---
 sys-libs/glibc/glibc-2.24-r4.ebuild  | 6 +++---
 sys-libs/glibc/glibc-2.25-r10.ebuild | 4 ++--
 sys-libs/glibc/glibc-2.25-r9.ebuild  | 6 +++---
 sys-libs/glibc/glibc-2.26-r3.ebuild  | 6 +++---
 sys-libs/glibc/glibc-2.26-r5.ebuild  | 4 ++--
 sys-libs/glibc/glibc-9999.ebuild     | 8 ++++----
 12 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.18-r1.ebuild b/sys-libs/glibc/glibc-2.18-r1.ebuild
index a9c0bfc2c2b..a056ef575af 100644
--- a/sys-libs/glibc/glibc-2.18-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.18-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 inherit toolchain-glibc
@@ -27,7 +27,7 @@ GCC_BOOTSTRAP_VER="4.7.3-r1"
 PATCH_VER="4"                                  # Gentoo patchset
 NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.16"}       # min kernel version nptl requires
 
-IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
 
 # Here's how the cross-compile logic breaks down ...
 #  CTARGET - machine that will target the binaries
@@ -72,7 +72,7 @@ RDEPEND="!sys-kernel/ps3-sources
 	!sys-libs/nss-db"
 
 if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
+	DEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.20
 		>=${CATEGORY}/gcc-4.3
 	)"

diff --git a/sys-libs/glibc/glibc-2.19-r1.ebuild b/sys-libs/glibc/glibc-2.19-r1.ebuild
index 8860850c022..a2b10e2a5c1 100644
--- a/sys-libs/glibc/glibc-2.19-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 inherit toolchain-glibc
@@ -27,7 +27,7 @@ GCC_BOOTSTRAP_VER="4.7.3-r1"
 PATCH_VER="3"                                  # Gentoo patchset
 NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.16"}       # min kernel version nptl requires
 
-IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
 
 # Here's how the cross-compile logic breaks down ...
 #  CTARGET - machine that will target the binaries
@@ -72,7 +72,7 @@ RDEPEND="!sys-kernel/ps3-sources
 	!sys-libs/nss-db"
 
 if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
+	DEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.20
 		>=${CATEGORY}/gcc-4.3
 	)"

diff --git a/sys-libs/glibc/glibc-2.20-r2.ebuild b/sys-libs/glibc/glibc-2.20-r2.ebuild
index 04363835f61..2c35723c25b 100644
--- a/sys-libs/glibc/glibc-2.20-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.20-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="4"
@@ -29,7 +29,7 @@ GCC_BOOTSTRAP_VER="4.7.3-r1"
 PATCH_VER="5"                                  # Gentoo patchset
 : ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
 
-IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
 
 # Here's how the cross-compile logic breaks down ...
 #  CTARGET - machine that will target the binaries
@@ -73,7 +73,7 @@ RDEPEND="!sys-kernel/ps3-sources
 	!sys-libs/nss-db"
 
 if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
+	DEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24
 		>=${CATEGORY}/gcc-4.4
 	)"

diff --git a/sys-libs/glibc/glibc-2.21-r2.ebuild b/sys-libs/glibc/glibc-2.21-r2.ebuild
index 9216657a970..6db7c6a7883 100644
--- a/sys-libs/glibc/glibc-2.21-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.21-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="4"
@@ -29,7 +29,7 @@ GCC_BOOTSTRAP_VER="4.7.3-r1"
 PATCH_VER="7"                                  # Gentoo patchset
 : ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
 
-IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
 
 # Here's how the cross-compile logic breaks down ...
 #  CTARGET - machine that will target the binaries
@@ -73,7 +73,7 @@ RDEPEND="!sys-kernel/ps3-sources
 	!sys-libs/nss-db"
 
 if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
+	DEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24
 		>=${CATEGORY}/gcc-4.6
 	)"

diff --git a/sys-libs/glibc/glibc-2.22-r4.ebuild b/sys-libs/glibc/glibc-2.22-r4.ebuild
index 5949f88d64a..416fec87178 100644
--- a/sys-libs/glibc/glibc-2.22-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.22-r4.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="4"
@@ -29,7 +29,7 @@ GCC_BOOTSTRAP_VER="4.7.3-r1"
 PATCH_VER="13"                                 # Gentoo patchset
 : ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
 
-IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
 
 # Here's how the cross-compile logic breaks down ...
 #  CTARGET - machine that will target the binaries
@@ -73,7 +73,7 @@ RDEPEND="!sys-kernel/ps3-sources
 	!sys-libs/nss-db"
 
 if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
+	DEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24
 		>=${CATEGORY}/gcc-4.6
 	)"

diff --git a/sys-libs/glibc/glibc-2.23-r4.ebuild b/sys-libs/glibc/glibc-2.23-r4.ebuild
index 01efec5a7b4..18fe392f108 100644
--- a/sys-libs/glibc/glibc-2.23-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.23-r4.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="5"
@@ -30,7 +30,7 @@ GCC_BOOTSTRAP_VER="4.7.3-r1"
 PATCH_VER="8"                                  # Gentoo patchset
 : ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
 
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla headers-only"
 
 # Here's how the cross-compile logic breaks down ...
 #  CTARGET - machine that will target the binaries
@@ -82,7 +82,7 @@ RDEPEND="${COMMON_DEPEND}
 	!sys-libs/nss-db"
 
 if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
+	DEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24
 		>=${CATEGORY}/gcc-4.7
 	)"

diff --git a/sys-libs/glibc/glibc-2.24-r4.ebuild b/sys-libs/glibc/glibc-2.24-r4.ebuild
index 29a17f827ae..eb338ca1447 100644
--- a/sys-libs/glibc/glibc-2.24-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.24-r4.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="5"
@@ -30,7 +30,7 @@ GCC_BOOTSTRAP_VER="4.7.3-r1"
 PATCH_VER="10"                                 # Gentoo patchset
 : ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
 
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla headers-only"
 
 # Here's how the cross-compile logic breaks down ...
 #  CTARGET - machine that will target the binaries
@@ -82,7 +82,7 @@ RDEPEND="${COMMON_DEPEND}
 	!sys-libs/nss-db"
 
 if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
+	DEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24
 		>=${CATEGORY}/gcc-4.7
 	)"

diff --git a/sys-libs/glibc/glibc-2.25-r10.ebuild b/sys-libs/glibc/glibc-2.25-r10.ebuild
index 71709c387e7..89b89e76240 100644
--- a/sys-libs/glibc/glibc-2.25-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r10.ebuild
@@ -32,7 +32,7 @@ PATCH_VER="13"                                  # Gentoo patchset
 
 GLIBC_PATCH_EXCLUDE+=" 0005_all_sys-types.h-drop-sys-sysmacros.h-include.patch"
 
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla headers-only"
 
 # Here's how the cross-compile logic breaks down ...
 #  CTARGET - machine that will target the binaries
@@ -85,7 +85,7 @@ RDEPEND="${COMMON_DEPEND}
 	!sys-libs/nss-db"
 
 if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
+	DEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24
 		>=${CATEGORY}/gcc-4.7
 	)"

diff --git a/sys-libs/glibc/glibc-2.25-r9.ebuild b/sys-libs/glibc/glibc-2.25-r9.ebuild
index 62c5c1ac0cf..e31acb3be95 100644
--- a/sys-libs/glibc/glibc-2.25-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r9.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="5"
@@ -32,7 +32,7 @@ PATCH_VER="12"                                  # Gentoo patchset
 
 GLIBC_PATCH_EXCLUDE+=" 0005_all_sys-types.h-drop-sys-sysmacros.h-include.patch"
 
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla headers-only"
 
 # Here's how the cross-compile logic breaks down ...
 #  CTARGET - machine that will target the binaries
@@ -85,7 +85,7 @@ RDEPEND="${COMMON_DEPEND}
 	!sys-libs/nss-db"
 
 if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
+	DEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24
 		>=${CATEGORY}/gcc-4.7
 	)"

diff --git a/sys-libs/glibc/glibc-2.26-r3.ebuild b/sys-libs/glibc/glibc-2.26-r3.ebuild
index b936a612e1f..84dc10f4055 100644
--- a/sys-libs/glibc/glibc-2.26-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r3.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -32,7 +32,7 @@ PATCH_VER=4
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
 
-IUSE="audit caps debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+IUSE="audit caps debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
 
 # Min kernel version glibc requires
 : ${NPTL_KERN_VER:="3.2.0"}
@@ -89,7 +89,7 @@ RDEPEND="${COMMON_DEPEND}
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
+	DEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24
 		>=${CATEGORY}/gcc-4.9
 	)"

diff --git a/sys-libs/glibc/glibc-2.26-r5.ebuild b/sys-libs/glibc/glibc-2.26-r5.ebuild
index c5a076afbdb..4eb6b34679f 100644
--- a/sys-libs/glibc/glibc-2.26-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r5.ebuild
@@ -32,7 +32,7 @@ PATCH_VER=5
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
 
-IUSE="audit caps debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+IUSE="audit caps debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
 
 # Min kernel version glibc requires
 : ${NPTL_KERN_VER:="3.2.0"}
@@ -89,7 +89,7 @@ RDEPEND="${COMMON_DEPEND}
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
+	DEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24
 		>=${CATEGORY}/gcc-4.9
 	)"

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2aed938db02..5d7f3a9fbe9 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -33,7 +33,7 @@ PATCH_VER="3"
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
 
-IUSE="audit caps compile-locales debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+IUSE="audit caps compile-locales debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
 
 # Min kernel version glibc requires
 : ${NPTL_KERN_VER:="3.2.0"}
@@ -65,7 +65,7 @@ is_crosscompile() {
 }
 
 just_headers() {
-	is_crosscompile && use crosscompile_opts_headers-only
+	is_crosscompile && use headers-only
 }
 
 SLOT="2.2"
@@ -94,7 +94,7 @@ RDEPEND="${COMMON_DEPEND}
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !crosscompile_opts_headers-only? (
+	DEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24
 		>=${CATEGORY}/gcc-4.9
 	)"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-10  8:09 Mike Frysinger
  0 siblings, 0 replies; 1076+ messages in thread
From: Mike Frysinger @ 2018-01-10  8:09 UTC (permalink / raw
  To: gentoo-commits

commit:     b18444c395708d367b5092f3b39a7fd05d7468c8
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 10 08:08:51 2018 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Jan 10 08:08:59 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b18444c3

sys-libs/glibc: mark 2.25-r9 m68k/s390/sh stable

 sys-libs/glibc/glibc-2.25-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r9.ebuild b/sys-libs/glibc/glibc-2.25-r9.ebuild
index e31acb3be95..4e27a250e20 100644
--- a/sys-libs/glibc/glibc-2.25-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r9.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-13 17:14 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-01-13 17:14 UTC (permalink / raw
  To: gentoo-commits

commit:     fa36833c36bca58c311f3f2b0e81bcaaafdb99bb
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 13 15:17:02 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jan 13 17:12:31 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fa36833c

sys-libs/glibc: Integrate all eclass code

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-9999.ebuild | 558 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 557 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 5d7f3a9fbe9..d8392d208ae 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -3,7 +3,8 @@
 
 EAPI=6
 
-inherit prefix toolchain-glibc
+inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd unpacker multiprocessing
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
@@ -110,6 +111,507 @@ else
 fi
 
 #
+# helper functions
+#
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This indirection is for binpkgs. #523332
+_nonfatal() { nonfatal "$@" ; }
+
+# We need to be able to set alternative headers for
+# compiling for non-native platform
+# Will also become useful for testing kernel-headers without screwing up
+# the whole system.
+# note: intentionally undocumented.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+glibc_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	_nonfatal emake -s glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+glibc_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		glibc_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! glibc_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			if ! glibc_compile_test "" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n' 2>/dev/null ; then
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		amd64)
+			# -march needed for #185404 #199334
+			# Note: This test only matters when the x86 ABI is enabled, so we could
+			# optimize a bit and elide it.
+			# TODO: See cross-compile issues listed above for x86.
+			if ! glibc_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' 2>/dev/null ; 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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if version_is_at_least 2.8 ; then
+						cpu="sparc64v2"
+					elif version_is_at_least 2.4 ; then
+						cpu="sparc64v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if version_is_at_least 2.4 ; then
+						cpu="sparc64v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if version_is_at_least 2.8 ; then
+						cpu="sparcv9v2"
+					elif version_is_at_least 2.4 ; then
+						cpu="sparcv9v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if version_is_at_least 2.4 ; then
+						cpu="sparcv9v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Over-zealous CFLAGS can often cause problems.  What may work for one
+	# person may not work for another.  To avoid a large influx of bugs
+	# relating to failed builds, we strip most CFLAGS out to ensure as few
+	# problems as possible.
+	strip-flags
+	strip-unsupported-flags
+	filter-flags -m32 -m64 -mabi=*
+
+	# Bug 492892.
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# Lock glibc at -O2 -- linuxthreads needs it and we want to be
+	# conservative here.  -fno-strict-aliasing is to work around #155906
+	filter-flags -O?
+	append-flags -O2 -fno-strict-aliasing
+
+	# Can't build glibc itself with fortify code.  Newer versions add
+	# this flag for us, so no need to do it manually.
+	version_is_at_least 2.16 ${PV} || append-cppflags -U_FORTIFY_SOURCE
+
+	# building glibc <2.25 with SSP is fraught with difficulty, especially
+	# due to __stack_chk_fail_local which would mean significant changes
+	# to the glibc build process. See bug #94325 #293721
+	# Note we have to handle both user-given CFLAGS and gcc defaults via
+	# spec rules here.  We can't simply add -fno-stack-protector as it gets
+	# added before user flags, and we can't just filter-flags because
+	# _filter_hardened doesn't support globs.
+	filter-flags -fstack-protector*
+	if ! version_is_at_least 2.25 ; then
+		tc-enables-ssp && append-flags $(test-flags -fno-stack-protector)
+	fi
+
+	if [[ $(gcc-major-version) -lt 6 ]]; then
+		# Starting with gcc-6 (and fully upstreamed pie patches) we control
+		# default enabled/disabled pie via use flags. So nothing to do
+		# here. #618160
+
+		if use hardened && tc-enables-pie ; then
+			# Force PIC macro definition for all compilations since they're all
+			# either -fPIC or -fPIE with the default-PIE compiler.
+			append-cppflags -DPIC
+		else
+			# Don't build -fPIE without the default-PIE compiler and the
+			# hardened-pie patch
+			filter-flags -fPIE
+		fi
+	fi
+}
+
+want_nptl() {
+	[[ -z ${LT_VER} ]] && return 0
+	want_tls || return 1
+	use nptl || return 1
+
+	# Older versions of glibc had incomplete arch support for nptl.
+	# But if you're building those now, you can handle USE=nptl yourself.
+	return 0
+}
+
+want_linuxthreads() {
+	[[ -z ${LT_VER} ]] && return 1
+	use linuxthreads
+}
+
+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}
+}
+
+use_multiarch() {
+	# Make sure binutils is new enough to support indirect functions #336792
+	# This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc was added in 2.23, but glibc also needs machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	version_is_at_least ${nver} ${bver}
+}
+
+# Setup toolchain variables that had historically
+# been defined in the profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${SNAP_VER} ]] && b+=" snapshot ${SNAP_VER}"
+	[[ -n ${BRANCH_UPDATE} ]] && b+=" branch ${BRANCH_UPDATE}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ ${ROOT} != "/" ]] && return
+
+	# Older versions always installed setuid, so no need to check.
+	in_iuse suid || return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		# Do not die on older kernels as devpts did not export these settings #489520.
+		if version_is_at_least 2.6.25 $(uname -r) ; then
+			die "mount & fix your /dev/pts settings"
+		fi
+	fi
+}
+
+int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(KV_to_int $1) -ge $(KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+check_nptl_support() {
+	# don't care about the compiler here as we aren't using it
+	just_headers && return
+
+	local run_kv build_kv want_kv
+	run_kv=$(int_to_KV $(get_KV))
+	build_kv=$(int_to_KV $(get_kheader_version))
+	want_kv=${NPTL_KERN_VER}
+
+	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!"
+	fi
+
+	if ! is_crosscompile && ! tc-is-cross-compiler ; then
+		# Building fails on an non-supporting kernel
+		ebegin "Checking kernel version (${run_kv} >= ${want_kv})"
+		if ! eend_KV ${run_kv} ${want_kv} ; then
+			echo
+			eerror "You need a kernel of at least ${want_kv} for NPTL support!"
+			die "Kernel version too low!"
+		fi
+	fi
+
+	ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+	if ! eend_KV ${build_kv} ${want_kv} ; then
+		echo
+		eerror "You need linux-headers of at least ${want_kv} for NPTL support!"
+		die "linux-headers version too low!"
+	fi
+}
+
+#
 # the phases
 #
 
@@ -789,6 +1291,23 @@ glibc_headers_install() {
 	dosym usr/include $(alt_prefix)/sys-include
 }
 
+src_strip() {
+	# gdb is lame and requires some debugging information to remain in
+	# libpthread, so we need to strip it by hand.  libthread_db makes no
+	# sense stripped as it is only used when debugging.
+	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
+	env \
+		-uRESTRICT \
+		CHOST=${CTARGET} \
+		STRIP_MASK="/*/{,tls/}${pthread}*" \
+		prepallstrip
+	# if user has stripping enabled and does not have split debug turned on,
+	# then leave the debugging sections in libpthread.
+	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
+		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"/*/libpthread-*.so
+	fi
+}
+
 src_install() {
 	if just_headers ; then
 		export ABI=default
@@ -800,6 +1319,43 @@ src_install() {
 	src_strip
 }
 
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
 pkg_preinst() {
 	# nothing to do if just installing headers
 	just_headers && return


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-13 21:25 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-01-13 21:25 UTC (permalink / raw
  To: gentoo-commits

commit:     e77866cf2155f9b9a74c015589f3ac95a8edc2be
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 13 21:24:53 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jan 13 21:25:15 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e77866cf

sys-libs/glibc: Various cleanups. Work in progress.

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-9999.ebuild | 95 +++++++++++++---------------------------
 1 file changed, 30 insertions(+), 65 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index d8392d208ae..065f1eb24bd 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -4,16 +4,13 @@
 EAPI=6
 
 inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd unpacker multiprocessing
+	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
-
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
 RESTRICT="strip" # Strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
+SLOT="2.2"
 
 if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
@@ -36,8 +33,8 @@ SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOO
 
 IUSE="audit caps compile-locales debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
 
-# Min kernel version glibc requires
-: ${NPTL_KERN_VER:="3.2.0"}
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
 
 # Here's how the cross-compile logic breaks down ...
 #  CTARGET - machine that will target the binaries
@@ -52,7 +49,7 @@ IUSE="audit caps compile-locales debug doc gd hardened multilib nscd selinux sys
 # For install paths:
 #  CHOST = CTARGET  - install into /
 #  CHOST != CTARGET - install into /usr/CTARGET/
-
+#
 export CBUILD=${CBUILD:-${CHOST}}
 export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
@@ -61,18 +58,8 @@ if [[ ${CTARGET} == ${CHOST} ]] ; then
 	fi
 fi
 
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS.
 COMMON_DEPEND="
 	nscd? ( selinux? (
 		audit? ( sys-process/audit )
@@ -89,8 +76,8 @@ DEPEND="${COMMON_DEPEND}
 	doc? ( sys-apps/texinfo )
 "
 RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
 	sys-apps/gentoo-functions
+	!sys-kernel/ps3-sources
 	!sys-libs/nss-db
 "
 
@@ -111,24 +98,28 @@ else
 fi
 
 #
-# helper functions
+# Small helper functions
 #
 
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
 alt_prefix() {
 	is_crosscompile && echo /usr/${CTARGET}
 }
 
-# This indirection is for binpkgs. #523332
-_nonfatal() { nonfatal "$@" ; }
-
-# We need to be able to set alternative headers for
-# compiling for non-native platform
-# Will also become useful for testing kernel-headers without screwing up
-# the whole system.
-# note: intentionally undocumented.
+# We need to be able to set alternative headers for compiling for non-native 
+# platform. Will also become useful for testing kernel-headers without screwing 
+# up the whole system.
 alt_headers() {
 	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
 }
+
 alt_build_headers() {
 	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
 		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
@@ -164,7 +155,7 @@ glibc_compile_test() {
 	rm -f glibc-test*
 	printf '%b' "$*" > glibc-test.c
 
-	_nonfatal emake -s glibc-test
+	nonfatal emake -s glibc-test
 	ret=$?
 
 	popd >/dev/null
@@ -347,7 +338,10 @@ setup_flags() {
 	# problems as possible.
 	strip-flags
 	strip-unsupported-flags
-	filter-flags -m32 -m64 -mabi=*
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
 
 	# Bug 492892.
 	filter-flags -frecord-gcc-switches
@@ -366,24 +360,14 @@ setup_flags() {
 
 	# Lock glibc at -O2 -- linuxthreads needs it and we want to be
 	# conservative here.  -fno-strict-aliasing is to work around #155906
-	filter-flags -O?
+	filter-flags '-O?'
 	append-flags -O2 -fno-strict-aliasing
 
 	# Can't build glibc itself with fortify code.  Newer versions add
 	# this flag for us, so no need to do it manually.
 	version_is_at_least 2.16 ${PV} || append-cppflags -U_FORTIFY_SOURCE
 
-	# building glibc <2.25 with SSP is fraught with difficulty, especially
-	# due to __stack_chk_fail_local which would mean significant changes
-	# to the glibc build process. See bug #94325 #293721
-	# Note we have to handle both user-given CFLAGS and gcc defaults via
-	# spec rules here.  We can't simply add -fno-stack-protector as it gets
-	# added before user flags, and we can't just filter-flags because
-	# _filter_hardened doesn't support globs.
-	filter-flags -fstack-protector*
-	if ! version_is_at_least 2.25 ; then
-		tc-enables-ssp && append-flags $(test-flags -fno-stack-protector)
-	fi
+	filter-flags '-fstack-protector*'
 
 	if [[ $(gcc-major-version) -lt 6 ]]; then
 		# Starting with gcc-6 (and fully upstreamed pie patches) we control
@@ -402,21 +386,6 @@ setup_flags() {
 	fi
 }
 
-want_nptl() {
-	[[ -z ${LT_VER} ]] && return 0
-	want_tls || return 1
-	use nptl || return 1
-
-	# Older versions of glibc had incomplete arch support for nptl.
-	# But if you're building those now, you can handle USE=nptl yourself.
-	return 0
-}
-
-want_linuxthreads() {
-	[[ -z ${LT_VER} ]] && return 1
-	use linuxthreads
-}
-
 want_tls() {
 	# Archs that can use TLS (Thread Local Storage)
 	case $(tc-arch) in
@@ -518,10 +487,6 @@ foreach_abi() {
 	return ${ret}
 }
 
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
 glibc_banner() {
 	local b="Gentoo ${PVR}"
 	[[ -n ${SNAP_VER} ]] && b+=" snapshot ${SNAP_VER}"
@@ -583,7 +548,7 @@ check_nptl_support() {
 	local run_kv build_kv want_kv
 	run_kv=$(int_to_KV $(get_KV))
 	build_kv=$(int_to_KV $(get_kheader_version))
-	want_kv=${NPTL_KERN_VER}
+	want_kv=${MIN_KERN_VER}
 
 	ebegin "Checking gcc for __thread support"
 	if ! eend $(want__thread ; echo $?) ; then
@@ -857,7 +822,7 @@ glibc_do_configure() {
 
 	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
 
-	myconf+=( --enable-kernel=${NPTL_KERN_VER} )
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
 
 	# Since SELinux support is only required for nscd, only enable it if:
 	# 1. USE selinux


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-14 12:36 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-01-14 12:36 UTC (permalink / raw
  To: gentoo-commits

commit:     4340965e0b0d7fad2086b6f18c95f292c13afd69
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 14 12:35:44 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Jan 14 12:36:23 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4340965e

sys-libs/glibc: More cleanups. Work in progress.

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-9999.ebuild | 90 +++++++++++++++-------------------------
 1 file changed, 34 insertions(+), 56 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 065f1eb24bd..03044ff42b9 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -145,7 +145,7 @@ builddir() {
 	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
 }
 
-glibc_compile_test() {
+do_compile_test() {
 	local ret save_cflags=${CFLAGS}
 	CFLAGS+=" $1"
 	shift
@@ -164,14 +164,14 @@ glibc_compile_test() {
 	return ${ret}
 }
 
-glibc_run_test() {
+do_run_test() {
 	local ret
 
 	if [[ ${MERGE_TYPE} == "binary" ]] ; then
 		# ignore build failures when installing a binary package #324685
-		glibc_compile_test "" "$@" 2>/dev/null || return 0
+		do_compile_test "" "$@" 2>/dev/null || return 0
 	else
-		if ! glibc_compile_test "" "$@" ; then
+		if ! do_compile_test "" "$@" ; then
 			ewarn "Simple build failed ... assuming this is desired #324685"
 			return 0
 		fi
@@ -203,7 +203,7 @@ setup_target_flags() {
 			# We could change main to _start and pass -nostdlib here so that we
 			# only test the gcc code compilation.  Or we could do a compile and
 			# then look for the symbol via scanelf.
-			if ! glibc_compile_test "" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n' 2>/dev/null ; then
+			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' 2>/dev/null ; then
 				local t=${CTARGET_OPT:-${CTARGET}}
 				t=${t%%-*}
 				filter-flags '-march=*'
@@ -216,7 +216,7 @@ setup_target_flags() {
 			# Note: This test only matters when the x86 ABI is enabled, so we could
 			# optimize a bit and elide it.
 			# TODO: See cross-compile issues listed above for x86.
-			if ! glibc_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' 2>/dev/null ; 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' 2>/dev/null ; then
 				local t=${CTARGET_OPT:-${CTARGET}}
 				t=${t%%-*}
 				# Normally the target is x86_64-xxx, so turn that into the -march that
@@ -343,7 +343,7 @@ setup_flags() {
 	# glibc aborts if rpath is set by LDFLAGS
 	filter-ldflags '-Wl,-rpath=*'
 
-	# Bug 492892.
+	# #492892
 	filter-flags -frecord-gcc-switches
 
 	unset CBUILD_OPT CTARGET_OPT
@@ -358,22 +358,17 @@ setup_flags() {
 		CBUILD_OPT=${CTARGET_OPT}
 	fi
 
-	# Lock glibc at -O2 -- linuxthreads needs it and we want to be
-	# conservative here.  -fno-strict-aliasing is to work around #155906
+	# Lock glibc at -O2; we want to be conservative here.
+	# -fno-strict-aliasing is to work around #155906.
 	filter-flags '-O?'
 	append-flags -O2 -fno-strict-aliasing
 
-	# Can't build glibc itself with fortify code.  Newer versions add
-	# this flag for us, so no need to do it manually.
-	version_is_at_least 2.16 ${PV} || append-cppflags -U_FORTIFY_SOURCE
-
 	filter-flags '-fstack-protector*'
 
+	# Starting with gcc-6 (and fully upstreamed pie patches) we control
+	# default enabled/disabled pie via use flags. So nothing to do
+	# here then. #618160
 	if [[ $(gcc-major-version) -lt 6 ]]; then
-		# Starting with gcc-6 (and fully upstreamed pie patches) we control
-		# default enabled/disabled pie via use flags. So nothing to do
-		# here. #618160
-
 		if use hardened && tc-enables-pie ; then
 			# Force PIC macro definition for all compilations since they're all
 			# either -fPIC or -fPIE with the default-PIE compiler.
@@ -395,7 +390,6 @@ want_tls() {
 			return 1
 		;;
 	esac
-
 	return 0
 }
 
@@ -415,8 +409,8 @@ want__thread() {
 }
 
 use_multiarch() {
-	# Make sure binutils is new enough to support indirect functions #336792
-	# This funky sed supports gold and bfd linkers.
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
 	local bver nver
 	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
 	case $(tc-arch ${CTARGET}) in
@@ -424,7 +418,8 @@ use_multiarch() {
 	arm)       nver="2.22" ;;
 	hppa)      nver="2.23" ;;
 	ppc|ppc64) nver="2.20" ;;
-	# ifunc was added in 2.23, but glibc also needs machinemode which is in 2.24.
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
 	s390)      nver="2.24" ;;
 	sparc)     nver="2.21" ;;
 	*)         return 1 ;;
@@ -432,8 +427,8 @@ use_multiarch() {
 	version_is_at_least ${nver} ${bver}
 }
 
-# Setup toolchain variables that had historically
-# been defined in the profiles for these archs.
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
 setup_env() {
 	# silly users
 	unset LD_RUN_PATH
@@ -489,8 +484,6 @@ foreach_abi() {
 
 glibc_banner() {
 	local b="Gentoo ${PVR}"
-	[[ -n ${SNAP_VER} ]] && b+=" snapshot ${SNAP_VER}"
-	[[ -n ${BRANCH_UPDATE} ]] && b+=" branch ${BRANCH_UPDATE}"
 	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
 	echo "${b}"
 }
@@ -504,9 +497,6 @@ check_devpts() {
 	# Only sanity check when installing the native glibc.
 	[[ ${ROOT} != "/" ]] && return
 
-	# Older versions always installed setuid, so no need to check.
-	in_iuse suid || return
-
 	# If they're opting in to the old suid code, then no need to check.
 	use suid && return
 
@@ -515,10 +505,7 @@ check_devpts() {
 		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
 		eerror "Openrc should do this for you, so you should check /etc/fstab"
 		eerror "and make sure you do not have any invalid settings there."
-		# Do not die on older kernels as devpts did not export these settings #489520.
-		if version_is_at_least 2.6.25 $(uname -r) ; then
-			die "mount & fix your /dev/pts settings"
-		fi
+		die "mount & fix your /dev/pts settings"
 	fi
 }
 
@@ -542,11 +529,14 @@ get_kheader_version() {
 }
 
 check_nptl_support() {
-	# don't care about the compiler here as we aren't using it
+	# We don't care about the compiler here as we aren't using it
 	just_headers && return
 
 	local run_kv build_kv want_kv
+
+	# TODO: this needs to be replaced somehow
 	run_kv=$(int_to_KV $(get_KV))
+
 	build_kv=$(int_to_KV $(get_kheader_version))
 	want_kv=${MIN_KERN_VER}
 
@@ -563,7 +553,7 @@ check_nptl_support() {
 		ebegin "Checking kernel version (${run_kv} >= ${want_kv})"
 		if ! eend_KV ${run_kv} ${want_kv} ; then
 			echo
-			eerror "You need a kernel of at least ${want_kv} for NPTL support!"
+			eerror "You need a kernel of at least ${want_kv}!"
 			die "Kernel version too low!"
 		fi
 	fi
@@ -571,7 +561,7 @@ check_nptl_support() {
 	ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
 	if ! eend_KV ${build_kv} ${want_kv} ; then
 		echo
-		eerror "You need linux-headers of at least ${want_kv} for NPTL support!"
+		eerror "You need linux-headers of at least ${want_kv}!"
 		die "linux-headers version too low!"
 	fi
 }
@@ -591,31 +581,19 @@ pkg_pretend() {
 	   [[ ${ROOT} == "/" ]] && \
 	   [[ ${CBUILD} == ${CHOST} ]] && \
 	   [[ ${CHOST} == ${CTARGET} ]] ; then
-		# The high rev # is to allow people to downgrade between -r# versions.
-		# We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine.
-		# Hopefully we never actually use a r# this high.
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
 		if has_version ">${CATEGORY}/${P}-r10000" ; then
 			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction"
-			die "Aborting to save your system"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			die "Aborting to save your system."
 		fi
 
-		if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
-		then
-			eerror "Your patched vendor kernel is broken.  You need to get an"
-			eerror "update from whoever is providing the kernel to you."
-			eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227"
-			eerror "https://bugs.gentoo.org/262698"
-			die "Keeping your system alive, say thank you"
-		fi
-
-		if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
-		then
-			eerror "Your old kernel is broken.  You need to update it to"
-			eerror "a newer version as syscall(<bignum>) will break."
-			eerror "https://bugs.gentoo.org/279260"
-			die "Keeping your system alive, say thank you"
-		fi
+		# removed check for #262698 since it's about kernel 2.6.18 ...
+		# removed check for #279260 since it's about kernel <2.6.28 ...
 	fi
 
 	# Users have had a chance to phase themselves, time to give em the boot


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-14 19:17 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-01-14 19:17 UTC (permalink / raw
  To: gentoo-commits

commit:     dde6ba54bb52b54cd2c5260b979a5ad80f5b9baf
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 14 19:16:53 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Jan 14 19:17:30 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dde6ba54

sys-libs/glibc: Update patchset

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 3e03ec26dbb..4f6dde302fb 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,4 +19,4 @@ DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1
 DIST glibc-2.26-patches-4.tar.bz2 315447 BLAKE2B 038926c8c187cfea5c00a7017a486356adf0f0959dc8868847f26877b4b441bd76629f20d52967f9da878f69a1ac2859332ed3984b4ebb5cb528d50e0b012736 SHA512 04d229e5f9342d62f2fce039c70489609886782d8aabd49403863a1a679e3b0890ca26c129088738a4af7ef6d95c74f24fb3c4d03695bf7ba6e45eca4de1a5f0
 DIST glibc-2.26-patches-5.tar.bz2 357699 BLAKE2B 98a0cb231bf35a132747f1fa6e654a9ad2eff8b445f002a0239c9a45f5a896ad490570aedee2b43e6cfa94794ae5c8b5e312e369838c3770823f28b61b51b592 SHA512 0040469e4a85f5c2aac972e42aeb06b0adfc3a132b32b19306be9f1877339fe6651a2fbd4d90d502b07ae4460f74efbd1cd103d38a2038df9402b0a380f03c2a
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
-DIST glibc-9999-patches-3.tar.bz2 19892 BLAKE2B e0a51f376e7142f56ae2a0862a7723343ee378275c1a0c6c3a69607b5bb7f9bd655f0a68f8f9cfc32008e06852d0eb0a9e16c85ea9a395dc36b428f1ea6100d8 SHA512 75084b86a83d447d3a4b3959fa2a93d849e304ba9473ebec5570ca4fb5e2f8dfb38548faf3abc9fbd29b529f2c608b52eb2ef2e6e9a2ad5bea9a9298a19ef596
+DIST glibc-9999-patches-4.tar.bz2 15159 BLAKE2B e17e9efa196a1acf27dd1535bb43a8999eb4f76e7aecb47ee7fb1fb5258870ddc024a4a5d3fb514d3d37ce28326d3bae93f3c6f534c048b57a6369a1a135e0af SHA512 6e0f8ff9ee125e936a0e43f830423b13ac5350c9a8a83f1c4bb367084e9f2c81cf740f3d97e8bd451890ade46fadfe21154afecca739d00cf6ce1127dba4bb7b

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 03044ff42b9..0b6f444f771 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -26,7 +26,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER="4.7.3-r1"
 
 # Gentoo patchset
-PATCH_VER="3"
+PATCH_VER=4
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-17  1:04 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-01-17  1:04 UTC (permalink / raw
  To: gentoo-commits

commit:     a1f3af5b25c023776da8400c231b9c84aad039f9
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 17 01:03:52 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jan 17 01:04:03 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a1f3af5b

sys-libs/glibc: Bump 9999 patchset. Tests pass now on master (amd64).

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 4f6dde302fb..1e00b2e31b3 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,4 +19,4 @@ DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1
 DIST glibc-2.26-patches-4.tar.bz2 315447 BLAKE2B 038926c8c187cfea5c00a7017a486356adf0f0959dc8868847f26877b4b441bd76629f20d52967f9da878f69a1ac2859332ed3984b4ebb5cb528d50e0b012736 SHA512 04d229e5f9342d62f2fce039c70489609886782d8aabd49403863a1a679e3b0890ca26c129088738a4af7ef6d95c74f24fb3c4d03695bf7ba6e45eca4de1a5f0
 DIST glibc-2.26-patches-5.tar.bz2 357699 BLAKE2B 98a0cb231bf35a132747f1fa6e654a9ad2eff8b445f002a0239c9a45f5a896ad490570aedee2b43e6cfa94794ae5c8b5e312e369838c3770823f28b61b51b592 SHA512 0040469e4a85f5c2aac972e42aeb06b0adfc3a132b32b19306be9f1877339fe6651a2fbd4d90d502b07ae4460f74efbd1cd103d38a2038df9402b0a380f03c2a
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
-DIST glibc-9999-patches-4.tar.bz2 15159 BLAKE2B e17e9efa196a1acf27dd1535bb43a8999eb4f76e7aecb47ee7fb1fb5258870ddc024a4a5d3fb514d3d37ce28326d3bae93f3c6f534c048b57a6369a1a135e0af SHA512 6e0f8ff9ee125e936a0e43f830423b13ac5350c9a8a83f1c4bb367084e9f2c81cf740f3d97e8bd451890ade46fadfe21154afecca739d00cf6ce1127dba4bb7b
+DIST glibc-9999-patches-5.tar.bz2 15979 BLAKE2B f59b4d7096fd876c9176f6ebdd9a4a510f3c6c90dd69a1fbb092a18f296767759d8d73dc7a81e29e3f6152043a4179056d5e224896c7bb96cc09ede2e2dd16e1 SHA512 c29ad59977b2c4dfd58ee16d0898a1c16e6cde974d5c29c3a7a55e0dee4ade7f1a3d45c9481c1d35df7fcedbdb67267f5d61759cacab677b6288b5ece3871a4b

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 0b6f444f771..f7f93ffbd6e 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -26,12 +26,12 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER="4.7.3-r1"
 
 # Gentoo patchset
-PATCH_VER=4
+PATCH_VER=5
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
 
-IUSE="audit caps compile-locales debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
+IUSE="audit caps compile-locales debug doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-17 23:09 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-01-17 23:09 UTC (permalink / raw
  To: gentoo-commits

commit:     7c6130535ea0bd43a7fd69a46fe9eff7e2da216f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 17 23:09:16 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jan 17 23:09:32 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c613053

sys-libs/glibc: Drop old

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/Manifest             |   1 -
 sys-libs/glibc/glibc-2.26-r3.ebuild | 841 ------------------------------------
 2 files changed, 842 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 1e00b2e31b3..9fea34a7a68 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,7 +16,6 @@ DIST glibc-2.24.tar.xz 13554048 BLAKE2B 9f93ac00f68eb88e3a2272752624163fac25dd06
 DIST glibc-2.25-patches-12.tar.bz2 65396 BLAKE2B b23d5d681314c03b8dd5ad20516324c1ce5b24deb4d9ce03970dce97b524ee9d3f5d5463f2d6b7693e4c9ef25d006847f960993f55ca082fc961268d05f937ca SHA512 6af8c304ba70b42dfda294873d9a138d6c98e7a46496e305b2cac99a085d1ad3d00315162d1e1458e651de95e158bd35be74406a3f44fde13182e30baa663fcb
 DIST glibc-2.25-patches-13.tar.bz2 71481 BLAKE2B bf5691afabf03b579b8d634da30a2a967ab62d5e470a23b0946ff3354aa974b3b65821aca2f33dd30dd864a82459f4750178bf6ae01a5117ccfde62efd8f594e SHA512 7c80e4aba9edf0310e1707b03a6945f657d71267a4d0d67c24b979c841544a6a623d7c2dbb0a0d55863e25831439d717d096ecf377f936b731baeb04f21704a7
 DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
-DIST glibc-2.26-patches-4.tar.bz2 315447 BLAKE2B 038926c8c187cfea5c00a7017a486356adf0f0959dc8868847f26877b4b441bd76629f20d52967f9da878f69a1ac2859332ed3984b4ebb5cb528d50e0b012736 SHA512 04d229e5f9342d62f2fce039c70489609886782d8aabd49403863a1a679e3b0890ca26c129088738a4af7ef6d95c74f24fb3c4d03695bf7ba6e45eca4de1a5f0
 DIST glibc-2.26-patches-5.tar.bz2 357699 BLAKE2B 98a0cb231bf35a132747f1fa6e654a9ad2eff8b445f002a0239c9a45f5a896ad490570aedee2b43e6cfa94794ae5c8b5e312e369838c3770823f28b61b51b592 SHA512 0040469e4a85f5c2aac972e42aeb06b0adfc3a132b32b19306be9f1877339fe6651a2fbd4d90d502b07ae4460f74efbd1cd103d38a2038df9402b0a380f03c2a
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
 DIST glibc-9999-patches-5.tar.bz2 15979 BLAKE2B f59b4d7096fd876c9176f6ebdd9a4a510f3c6c90dd69a1fbb092a18f296767759d8d73dc7a81e29e3f6152043a4179056d5e224896c7bb96cc09ede2e2dd16e1 SHA512 c29ad59977b2c4dfd58ee16d0898a1c16e6cde974d5c29c3a7a55e0dee4ade7f1a3d45c9481c1d35df7fcedbdb67267f5d61759cacab677b6288b5ece3871a4b

diff --git a/sys-libs/glibc/glibc-2.26-r3.ebuild b/sys-libs/glibc/glibc-2.26-r3.ebuild
deleted file mode 100644
index 84dc10f4055..00000000000
--- a/sys-libs/glibc/glibc-2.26-r3.ebuild
+++ /dev/null
@@ -1,841 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix toolchain-glibc
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-
-# Gentoo patchset
-PATCH_VER=4
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
-
-IUSE="audit caps debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
-
-# Min kernel version glibc requires
-: ${NPTL_KERN_VER:="3.2.0"}
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	doc? ( sys-apps/texinfo )
-"
-RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.9
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.9
-		virtual/os-headers
-	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# the phases
-#
-
-pkg_pretend() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-		# The high rev # is to allow people to downgrade between -r# versions.
-		# We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine.
-		# Hopefully we never actually use a r# this high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction"
-			die "Aborting to save your system"
-		fi
-
-		if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
-		then
-			eerror "Your patched vendor kernel is broken.  You need to get an"
-			eerror "update from whoever is providing the kernel to you."
-			eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227"
-			eerror "https://bugs.gentoo.org/262698"
-			die "Keeping your system alive, say thank you"
-		fi
-
-		if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
-		then
-			eerror "Your old kernel is broken.  You need to update it to"
-			eerror "a newer version as syscall(<bignum>) will break."
-			eerror "https://bugs.gentoo.org/279260"
-			die "Keeping your system alive, say thank you"
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	use hardened && ! tc-enables-pie && \
-		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
-
-	# Make sure host system is up to date #394453
-	if has_version '<sys-libs/glibc-2.13' && \
-	   [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]]
-	then
-		ebegin "Scanning system for __guard to see if you need to rebuild first ..."
-		local files=$(
-			scanelf -qys__guard -F'#s%F' \
-				"${EROOT}"/*bin/ \
-				"${EROOT}"/lib* \
-				"${EROOT}"/usr/*bin/ \
-				"${EROOT}"/usr/lib* | \
-				egrep -v \
-					-e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \
-					-e "^${EROOT}/sbin/(ldconfig|sln)$"
-		)
-		[[ -z ${files} ]]
-		if ! eend $? ; then
-			eerror "Your system still has old SSP __guard symbols.  You need to"
-			eerror "rebuild all the packages that provide these files first:"
-			eerror "${files}"
-			die "old __guard detected"
-		fi
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-}
-
-src_unpack() {
-	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	setup_env
-
-	# Check NPTL support _before_ we unpack things to save some time
-	check_nptl_support
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}"
-	touch locale/C-translit.h #185476 #218003
-
-	cd "${WORKDIR}"
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	if just_headers ; then
-		if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
-			# mips peeps like to screw with us.  if building headers,
-			# we don't have a real compiler, so we can't let them
-			# insert -mabi on us.
-			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
-			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
-		fi
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-	fi
-}
-
-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 $1"
-
-	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 ; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-
-	# The glibc configure script doesn't properly use LDFLAGS all the time.
-	export CC="$(tc-getCC ${CTARGET}) ${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)"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	# set addons
-	pushd "${S}" > /dev/null
-	local addons=$(echo */configure | sed \
-		-e 's:/configure::g' \
-		-e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
-		-e 's: \+$::' \
-		-e 's! !,!g' \
-		-e 's!^!,!' \
-		-e '/^,\*$/d')
-	[[ -d ports ]] && addons+=",ports"
-	popd > /dev/null
-
-	case ${CTARGET} in
-		mips*)
-			# dlopen() detects stack smash on mips n32 ABI.
-			# Cause is unknown: https://bugs.gentoo.org/640130
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=all )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	if [[ $1 == "nptl" ]] ; then
-		myconf+=( --enable-kernel=${NPTL_KERN_VER} )
-	else
-		die "invalid pthread option"
-	fi
-	myconf+=( --enable-add-ons="${addons#,}" )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(in_iuse systemtap && use_enable systemtap)
-		$(in_iuse nscd && use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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 "$1")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-			mkdir -p sunrpc
-			cp $(which rpcgen) sunrpc/cross-rpcgen || die
-			touch -t 202001010101 sunrpc/cross-rpcgen || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	local addons
-	[[ -d ${S}/ports ]] && addons+=",ports"
-	myconf+=( --enable-add-ons="${addons#,}" )
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	CC="$(tc-getBUILD_CC)" \
-	CFLAGS="-O1 -pipe" \
-	CPPFLAGS="-U_FORTIFY_SOURCE" \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir $1)"
-	emake -j1 check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test nptl
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally real_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Newer versions get fancy with libm linkage to include vectorized support.
-	# While we don't really need a ldscript here, portage QA checks get upset.
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		dosym ../../$(get_libdir)/libm-${upstream_pv}.so $(alt_usrlibdir)/libm-${upstream_pv}.so
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if in_iuse suid && ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		cd "${ED}"$(alt_libdir)/..
-		[[ -e lib ]] || mkdir lib
-		cd "${ED}"$(alt_usrlibdir)/..
-		[[ -e lib ]] || mkdir lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		# if the host locales.gen contains no entries, we'll install everything
-		local locale_list="${EROOT}etc/locale.gen"
-		if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-			ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-			locale_list="${EROOT}usr/share/i18n/SUPPORTED"
-		fi
-		locale-gen -j $(makeopts_jobs) --config "${locale_list}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-20  0:51 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-01-20  0:51 UTC (permalink / raw
  To: gentoo-commits

commit:     79a05395f7f72e5f30fb9b8b4f765753ead17137
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 19 20:09:11 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jan 20 00:50:27 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=79a05395

sys-libs/glibc: Use linux-info.eclass to get running kernel, bug 587320

Bug: https://bugs.gentoo.org/587320
Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-9999.ebuild | 54 ++++++++++++++++++++++++++++++++++------
 1 file changed, 47 insertions(+), 7 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f7f93ffbd6e..f2132994237 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -4,7 +4,7 @@
 EAPI=6
 
 inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
+	multilib systemd multiprocessing linux-info
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
@@ -509,7 +509,46 @@ check_devpts() {
 	fi
 }
 
-int_to_KV() {
+# The following functions are copied from portage source and split a Kernel
+# version into its components.
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+    [[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+    return 1
+}
+
+g_int_to_KV() {
 	local version=$1 major minor micro
 	major=$((version / 65536))
 	minor=$(((version % 65536) / 256))
@@ -518,7 +557,7 @@ int_to_KV() {
 }
 
 eend_KV() {
-	[[ $(KV_to_int $1) -ge $(KV_to_int $2) ]]
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
 	eend $?
 }
 
@@ -534,10 +573,11 @@ check_nptl_support() {
 
 	local run_kv build_kv want_kv
 
-	# TODO: this needs to be replaced somehow
-	run_kv=$(int_to_KV $(get_KV))
+	# We get the running kernel version using linux-info.eclass
+	get_running_version
+	run_kv=${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}
 
-	build_kv=$(int_to_KV $(get_kheader_version))
+	build_kv=$(g_int_to_KV $(get_kheader_version))
 	want_kv=${MIN_KERN_VER}
 
 	ebegin "Checking gcc for __thread support"
@@ -550,7 +590,7 @@ check_nptl_support() {
 
 	if ! is_crosscompile && ! tc-is-cross-compiler ; then
 		# Building fails on an non-supporting kernel
-		ebegin "Checking kernel version (${run_kv} >= ${want_kv})"
+		ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
 		if ! eend_KV ${run_kv} ${want_kv} ; then
 			echo
 			eerror "You need a kernel of at least ${want_kv}!"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-20 16:57 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-01-20 16:57 UTC (permalink / raw
  To: gentoo-commits

commit:     ffbc9b4d0f08a5e46e071542e2034a0961efd94c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 20 16:56:58 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jan 20 16:57:29 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ffbc9b4d

sys-libs/glibc: On second thought, let's not use linux-info.eclass here.

It introduces too much magic and makes too many assumptions.
Still, we now do not use any deprecated portage features anymore.

Bug: https://bugs.gentoo.org/587320
Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-9999.ebuild | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f2132994237..a215358c1b2 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -4,7 +4,7 @@
 EAPI=6
 
 inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing linux-info
+	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
@@ -509,8 +509,15 @@ check_devpts() {
 	fi
 }
 
-# The following functions are copied from portage source and split a Kernel
-# version into its components.
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+        uname -r
+        return $?
+}
 
 g_KV_major() {
 	[[ -z $1 ]] && return 1
@@ -573,10 +580,7 @@ check_nptl_support() {
 
 	local run_kv build_kv want_kv
 
-	# We get the running kernel version using linux-info.eclass
-	get_running_version
-	run_kv=${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}
-
+	run_kv=$(g_get_running_KV)
 	build_kv=$(g_int_to_KV $(get_kheader_version))
 	want_kv=${MIN_KERN_VER}
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-20 17:16 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-01-20 17:16 UTC (permalink / raw
  To: gentoo-commits

commit:     a9e179bf517964dd38d81503ee5393e195b1cb6a
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 20 17:16:19 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jan 20 17:16:19 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a9e179bf

sys-libs/glibc: rpcgen is not used here anymore, so no need for special treatmet at abi migration

Bug: https://bugs.gentoo.org/644700
Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-9999.ebuild | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a215358c1b2..522a3674fe0 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -935,16 +935,10 @@ glibc_do_configure() {
 	# is built with MULTILIB_ABIS="amd64 x86" but we want to
 	# add x32 to it, gcc/glibc don't yet support x32.
 	#
-	# This reqires net-libs/rpcsvc-proto now (which provides
-	# rpcgen) !!! Needs analysis how to best add to deps.
-	#
 	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
 		echo 'main(){}' > "${T}"/test.c
 		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
 			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-			mkdir -p sunrpc
-			cp $(which rpcgen) sunrpc/cross-rpcgen || die
-			touch -t 202001010101 sunrpc/cross-rpcgen || die
 		fi
 	fi
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-20 17:36 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-01-20 17:36 UTC (permalink / raw
  To: gentoo-commits

commit:     4dfbdb5451ec3041b206bc057b5c1a2eb2a6b774
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 20 17:35:27 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jan 20 17:36:07 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4dfbdb54

sys-libs/glibc: Test for IA32 emulation before building amd64 multilib glibc, bug 326693.

Based on the patch by Steven Presser.

Closes: https://bugs.gentoo.org/326693
Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-9999.ebuild | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 522a3674fe0..81dadb17794 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -701,6 +701,23 @@ pkg_pretend() {
 			fi
 		done
 	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+
+		if use amd64 && use multilib ; then
+			ebegin "Checking that IA32 emulation is enabled in the running kernel"
+			echo 'int main(){return 0;}' > "${T}/check-ia32-emulation.c"
+			"${CC-${CHOST}-gcc}" ${CFLAGS_x86} "${T}/check-ia32-emulation.c" -o "${T}/check-ia32-emulation.elf32"
+			"${T}/check-ia32-emulation.elf32"
+			local STAT=$?
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[ $STAT -eq 0 ] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
 }
 # todo: shouldn't most of these checks be called also in src_configure again?
 # (since consistency is not guaranteed between pkg_ and src_)


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-20 18:13 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-01-20 18:13 UTC (permalink / raw
  To: gentoo-commits

commit:     c865354644b43a2f36c3feb5aba5ca60a4e179f9
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 20 18:12:20 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jan 20 18:13:09 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8653546

sys-libs/glibc: Do not check for IA32 abi when merging binary package

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 224a4f232d0..87549b89f6d 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -640,7 +640,7 @@ sanity_prechecks() {
 	# we test for...
 	if ! is_crosscompile ; then
 
-		if use amd64 && use multilib ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
 			ebegin "Checking that IA32 emulation is enabled in the running kernel"
 			echo 'int main(){return 0;}' > "${T}/check-ia32-emulation.c"
 			"${CC-${CHOST}-gcc}" ${CFLAGS_x86} "${T}/check-ia32-emulation.c" -o "${T}/check-ia32-emulation.elf32"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-20 18:13 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-01-20 18:13 UTC (permalink / raw
  To: gentoo-commits

commit:     45d742aedff0cfa1b1c87ea8856a47b61188a1f1
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 20 18:05:27 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jan 20 18:13:06 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=45d742ae

sys-libs/glibc: Restructure sanity tests

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-9999.ebuild | 125 ++++++++++++++++-----------------------
 1 file changed, 51 insertions(+), 74 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 81dadb17794..224a4f232d0 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -574,49 +574,10 @@ get_kheader_version() {
 	tail -n 1
 }
 
-check_nptl_support() {
-	# We don't care about the compiler here as we aren't using it
-	just_headers && return
-
-	local run_kv build_kv want_kv
-
-	run_kv=$(g_get_running_KV)
-	build_kv=$(g_int_to_KV $(get_kheader_version))
-	want_kv=${MIN_KERN_VER}
-
-	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!"
-	fi
-
-	if ! is_crosscompile && ! tc-is-cross-compiler ; then
-		# Building fails on an non-supporting kernel
-		ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-		if ! eend_KV ${run_kv} ${want_kv} ; then
-			echo
-			eerror "You need a kernel of at least ${want_kv}!"
-			die "Kernel version too low!"
-		fi
-	fi
-
-	ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-	if ! eend_KV ${build_kv} ${want_kv} ; then
-		echo
-		eerror "You need linux-headers of at least ${want_kv}!"
-		die "linux-headers version too low!"
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we can call this function both in pkg_pretend
+# and in src_configure.
+sanity_prechecks() {
 	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
 	check_devpts
 
@@ -635,9 +596,6 @@ pkg_pretend() {
 			eerror " Downgrading glibc is not supported and a sure way to destruction."
 			die "Aborting to save your system."
 		fi
-
-		# removed check for #262698 since it's about kernel 2.6.18 ...
-		# removed check for #279260 since it's about kernel <2.6.28 ...
 	fi
 
 	# Users have had a chance to phase themselves, time to give em the boot
@@ -663,30 +621,6 @@ pkg_pretend() {
 	use hardened && ! tc-enables-pie && \
 		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
 
-	# Make sure host system is up to date #394453
-	if has_version '<sys-libs/glibc-2.13' && \
-	   [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]]
-	then
-		ebegin "Scanning system for __guard to see if you need to rebuild first ..."
-		local files=$(
-			scanelf -qys__guard -F'#s%F' \
-				"${EROOT}"/*bin/ \
-				"${EROOT}"/lib* \
-				"${EROOT}"/usr/*bin/ \
-				"${EROOT}"/usr/lib* | \
-				egrep -v \
-					-e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \
-					-e "^${EROOT}/sbin/(ldconfig|sln)$"
-		)
-		[[ -z ${files} ]]
-		if ! eend $? ; then
-			eerror "Your system still has old SSP __guard symbols.  You need to"
-			eerror "rebuild all the packages that provide these files first:"
-			eerror "${files}"
-			die "old __guard detected"
-		fi
-	fi
-
 	# Check for sanity of /etc/nsswitch.conf
 	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
 		local entry
@@ -718,6 +652,53 @@ pkg_pretend() {
 		fi
 
 	fi
+
+	# When we actually have to compile something...
+	if ! just_headers ; then
+		local run_kv build_kv want_kv
+
+		run_kv=$(g_get_running_KV)
+		build_kv=$(g_int_to_KV $(get_kheader_version))
+		want_kv=${MIN_KERN_VER}
+
+		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!"
+		fi
+
+		if ! is_crosscompile && ! tc-is-cross-compiler ; then
+			# Building fails on an non-supporting kernel
+			ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+			if ! eend_KV ${run_kv} ${want_kv} ; then
+				echo
+				eerror "You need a kernel of at least ${want_kv}!"
+				die "Kernel version too low!"
+			fi
+		fi
+
+		ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+		if ! eend_KV ${build_kv} ${want_kv} ; then
+			echo
+			eerror "You need linux-headers of at least ${want_kv}!"
+			die "linux-headers version too low!"
+		fi
+	fi
+}
+
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
 }
 # todo: shouldn't most of these checks be called also in src_configure again?
 # (since consistency is not guaranteed between pkg_ and src_)
@@ -729,10 +710,6 @@ src_unpack() {
 
 	setup_env
 
-	# Check NPTL support _before_ we unpack things to save some time
-	check_nptl_support
-	# todo: 1) move this to pkg_pretend? 2) use proper functions for kv
-
 	if [[ -n ${EGIT_REPO_URI} ]] ; then
 		git-r3_src_unpack
 	else


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-20 19:14 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-01-20 19:14 UTC (permalink / raw
  To: gentoo-commits

commit:     e1643a784e0c0626933e93d60e6dc229deb0757e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 20 19:14:07 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jan 20 19:14:23 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e1643a78

sys-libs/glibc: Re-add check for bug 279260, see bug 645016 comment 2

Bug: https://bugs.gentoo.org/279260
Bug: https://bugs.gentoo.org/645016
Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-9999.ebuild | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 87549b89f6d..a739da784a7 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -612,6 +612,12 @@ sanity_prechecks() {
 		die "Please fix your CHOST"
 	fi
 
+	if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+		eerror "Your old kernel is broken. You need to update it to a newer"
+		eerror "version as syscall(<bignum>) will break. See bug 279260."
+		die "Old and broken kernel."
+	fi
+
 	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
 		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
 		ewarn "This will result in a 50% performance penalty when running with a 32bit"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-20 19:26 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-01-20 19:26 UTC (permalink / raw
  To: gentoo-commits

commit:     cf437375881c81020d86f374dfc93df55fe879ef
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 20 19:25:28 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jan 20 19:25:57 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf437375

sys-libs/glibc: Re-run sanity checks in src_unpack

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-9999.ebuild | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a739da784a7..4e1724bb599 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -575,8 +575,8 @@ get_kheader_version() {
 }
 
 # We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we can call this function both in pkg_pretend
-# and in src_configure.
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
 sanity_prechecks() {
 	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
 	check_devpts
@@ -706,12 +706,13 @@ pkg_pretend() {
 	einfo "Checking general environment sanity."
 	sanity_prechecks
 }
-# todo: shouldn't most of these checks be called also in src_configure again?
-# (since consistency is not guaranteed between pkg_ and src_)
 
 # src_unpack
 
 src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
 	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
 
 	setup_env
@@ -722,10 +723,10 @@ src_unpack() {
 		unpack ${P}.tar.xz
 	fi
 
-	cd "${S}"
-	touch locale/C-translit.h #185476 #218003
+	cd "${S}" || die
+	touch locale/C-translit.h || die #185476 #218003
 
-	cd "${WORKDIR}"
+	cd "${WORKDIR}" || die
 	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
 }
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-21 10:38 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-01-21 10:38 UTC (permalink / raw
  To: gentoo-commits

commit:     174f19e7da9273e42144bf59488318850ef095df
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 21 10:37:31 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jan 21 10:37:31 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=174f19e7

sys-libs/glibc: reenable stack protection on mips, bug #640130

mips and mips64 were fixed upstream in https://sourceware.org/PR22624

Bug: https://sourceware.org/PR22624
Closes: https://bugs.gentoo.org/640130
Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-2.26-r5.ebuild | 5 -----
 sys-libs/glibc/glibc-9999.ebuild    | 5 -----
 2 files changed, 10 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r5.ebuild b/sys-libs/glibc/glibc-2.26-r5.ebuild
index 4eb6b34679f..ca34027cda7 100644
--- a/sys-libs/glibc/glibc-2.26-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r5.ebuild
@@ -323,11 +323,6 @@ glibc_do_configure() {
 	popd > /dev/null
 
 	case ${CTARGET} in
-		mips*)
-			# dlopen() detects stack smash on mips n32 ABI.
-			# Cause is unknown: https://bugs.gentoo.org/640130
-			myconf+=( --enable-stack-protector=no )
-			;;
 		powerpc-*)
 			# Currently gcc on powerpc32 generates invalid code for
 			# __builtin_return_address(0) calls. Normally programs

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 4e1724bb599..cb0e4cb1111 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -813,11 +813,6 @@ glibc_do_configure() {
 	local myconf=()
 
 	case ${CTARGET} in
-		mips*)
-			# dlopen() detects stack smash on mips n32 ABI.
-			# Cause is unknown: https://bugs.gentoo.org/640130
-			myconf+=( --enable-stack-protector=no )
-			;;
 		powerpc-*)
 			# Currently gcc on powerpc32 generates invalid code for
 			# __builtin_return_address(0) calls. Normally programs


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-01-21 21:21 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-01-21 21:21 UTC (permalink / raw
  To: gentoo-commits

commit:     f8a3ee9e58ce671b0f6aca698f00535c7668c893
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 21 21:21:19 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Jan 21 21:21:19 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8a3ee9e

sys-libs/glibc: One less blank line

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-9999.ebuild | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index cb0e4cb1111..aa2a6a11a4e 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -694,7 +694,6 @@ sanity_prechecks() {
 	fi
 }
 
-
 #
 # the phases
 #


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-02 14:34 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-02-02 14:34 UTC (permalink / raw
  To: gentoo-commits

commit:     95d3d718426d5aef40f715a8d959926869d4f008
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  2 14:31:58 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Feb  2 14:34:27 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=95d3d718

sys-libs/glibc: Add bison version requirement

Package-Manager: Portage-2.3.23, Repoman-2.3.6

 sys-libs/glibc/glibc-9999.ebuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index aa2a6a11a4e..f52c1557769 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -73,6 +73,7 @@ DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
 	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2
+	!<sys-devel/bison-2.7
 	doc? ( sys-apps/texinfo )
 "
 RDEPEND="${COMMON_DEPEND}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-02 14:56 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-02-02 14:56 UTC (permalink / raw
  To: gentoo-commits

commit:     6b78adca56668c98bb5b0fe55d999a9d8d159413
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  2 14:56:13 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Feb  2 14:56:13 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6b78adca

sys-libs/glibc: Version bump. Untested, unkeyworded.

Package-Manager: Portage-2.3.23, Repoman-2.3.6

 sys-libs/glibc/Manifest                                 |  2 ++
 sys-libs/glibc/{glibc-9999.ebuild => glibc-2.27.ebuild} | 10 +++++-----
 sys-libs/glibc/glibc-9999.ebuild                        |  8 ++++----
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 9fea34a7a68..78d5765e530 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,4 +18,6 @@ DIST glibc-2.25-patches-13.tar.bz2 71481 BLAKE2B bf5691afabf03b579b8d634da30a2a9
 DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
 DIST glibc-2.26-patches-5.tar.bz2 357699 BLAKE2B 98a0cb231bf35a132747f1fa6e654a9ad2eff8b445f002a0239c9a45f5a896ad490570aedee2b43e6cfa94794ae5c8b5e312e369838c3770823f28b61b51b592 SHA512 0040469e4a85f5c2aac972e42aeb06b0adfc3a132b32b19306be9f1877339fe6651a2fbd4d90d502b07ae4460f74efbd1cd103d38a2038df9402b0a380f03c2a
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
+DIST glibc-2.27-patches-1.tar.bz2 15950 BLAKE2B ef2d2ede447b98c5e20f1bf1328f1379fd781b603a888f0fd7f1dbb6172e42222c9198d61dd75d9aafbed5c395a277a3c0d00ef4b70932fafb500b111e013963 SHA512 9e3ed7e271313c104eefcd383e6259c235b4e2f7a41be2ba8a1bfb469f8f54835ffde63ae89fa40af47b444911addb0db002a05d033bcc2832710b51650c91e3
+DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-9999-patches-5.tar.bz2 15979 BLAKE2B f59b4d7096fd876c9176f6ebdd9a4a510f3c6c90dd69a1fbb092a18f296767759d8d73dc7a81e29e3f6152043a4179056d5e224896c7bb96cc09ede2e2dd16e1 SHA512 c29ad59977b2c4dfd58ee16d0898a1c16e6cde974d5c29c3a7a55e0dee4ade7f1a3d45c9481c1d35df7fcedbdb67267f5d61759cacab677b6288b5ece3871a4b

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.27.ebuild
similarity index 99%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.27.ebuild
index f52c1557769..eb3ed1e514a 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.27.ebuild
@@ -26,7 +26,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER="4.7.3-r1"
 
 # Gentoo patchset
-PATCH_VER=5
+PATCH_VER=1
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
@@ -516,8 +516,8 @@ check_devpts() {
 # functions are just not provided.
 
 g_get_running_KV() {
-        uname -r
-        return $?
+	uname -r
+	return $?
 }
 
 g_KV_major() {
@@ -541,7 +541,7 @@ g_KV_micro() {
 }
 
 g_KV_to_int() {
-    [[ -z $1 ]] && return 1
+	[[ -z $1 ]] && return 1
 	local KV_MAJOR=$(g_KV_major "$1")
 	local KV_MINOR=$(g_KV_minor "$1")
 	local KV_MICRO=$(g_KV_micro "$1")
@@ -553,7 +553,7 @@ g_KV_to_int() {
 		echo "${KV_int}"
 		return 0
 	fi
-    return 1
+	return 1
 }
 
 g_int_to_KV() {

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f52c1557769..b172eb76679 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -516,8 +516,8 @@ check_devpts() {
 # functions are just not provided.
 
 g_get_running_KV() {
-        uname -r
-        return $?
+	uname -r
+	return $?
 }
 
 g_KV_major() {
@@ -541,7 +541,7 @@ g_KV_micro() {
 }
 
 g_KV_to_int() {
-    [[ -z $1 ]] && return 1
+	[[ -z $1 ]] && return 1
 	local KV_MAJOR=$(g_KV_major "$1")
 	local KV_MINOR=$(g_KV_minor "$1")
 	local KV_MICRO=$(g_KV_micro "$1")
@@ -553,7 +553,7 @@ g_KV_to_int() {
 		echo "${KV_int}"
 		return 0
 	fi
-    return 1
+	return 1
 }
 
 g_int_to_KV() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-03  0:49 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-02-03  0:49 UTC (permalink / raw
  To: gentoo-commits

commit:     a659d0f75880deedde3dce046a7deb64f4f62f29
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  3 00:47:46 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Feb  3 00:49:11 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a659d0f7

sys-libs/glibc: Hard-die in 2.27 as something's broken in amd64 multilib

Package-Manager: Portage-2.3.23, Repoman-2.3.6

 sys-libs/glibc/glibc-2.27.ebuild | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.27.ebuild b/sys-libs/glibc/glibc-2.27.ebuild
index eb3ed1e514a..ce108bfe60f 100644
--- a/sys-libs/glibc/glibc-2.27.ebuild
+++ b/sys-libs/glibc/glibc-2.27.ebuild
@@ -702,6 +702,8 @@ sanity_prechecks() {
 # pkg_pretend
 
 pkg_pretend() {
+	die "DONT TRY TO USE; BROKEN ON AMD64 MULTILIB."
+
 	# All the checks...
 	einfo "Checking general environment sanity."
 	sanity_prechecks


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-03  1:18 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-02-03  1:18 UTC (permalink / raw
  To: gentoo-commits

commit:     3a2f034415d6e9c5c0135136b4e28698f3a15767
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  3 01:17:00 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Feb  3 01:18:42 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3a2f0344

sys-libs/glibc: unbreak installation of non-default ABIs, bug #646424

multilib.eclass has a EMULTILIB_PKG="true" knob to declare package
as multilib-compatible. This knob was lost in glibc-2.27 in commit
e77866cf2155f9b9a74c015589f3ac95a8edc2be
("sys-libs/glibc: Various cleanups. Work in progress.")

Closes: https://bugs.gentoo.org/646424
Package-Manager: Portage-2.3.20, Repoman-2.3.6

 sys-libs/glibc/{glibc-2.27.ebuild => glibc-2.27-r1.ebuild} | 2 ++
 sys-libs/glibc/glibc-9999.ebuild                           | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.27.ebuild b/sys-libs/glibc/glibc-2.27-r1.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.27.ebuild
rename to sys-libs/glibc/glibc-2.27-r1.ebuild
index ce108bfe60f..4cb91870ba2 100644
--- a/sys-libs/glibc/glibc-2.27.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r1.ebuild
@@ -12,6 +12,8 @@ LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
 RESTRICT="strip" # Strip ourself #46186
 SLOT="2.2"
 
+EMULTILIB_PKG="true"
+
 if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index b172eb76679..3903ddf0d1b 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -12,6 +12,8 @@ LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
 RESTRICT="strip" # Strip ourself #46186
 SLOT="2.2"
 
+EMULTILIB_PKG="true"
+
 if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-03  1:38 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-02-03  1:38 UTC (permalink / raw
  To: gentoo-commits

commit:     2b297eb4b3b9114b1663b5affd9e3a9f0c22fedd
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  3 01:38:38 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Feb  3 01:38:38 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2b297eb4

sys-libs/glibc: restore ability to switch single->multiple ABIs

To recover broken system automatically from bug #646424
we need to skip IA32 ABI checks as those require multiabi
glibc checks at glibc build time.

There is no need to impose it as a requirement. Fail test
only if it compiled successfully and failed at runtime.

Bug: https://bugs.gentoo.org/326693
Bug: https://bugs.gentoo.org/646424
Package-Manager: Portage-2.3.20, Repoman-2.3.6

 sys-libs/glibc/glibc-2.27-r1.ebuild | 14 ++++++++++----
 sys-libs/glibc/glibc-9999.ebuild    | 14 ++++++++++----
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.27-r1.ebuild b/sys-libs/glibc/glibc-2.27-r1.ebuild
index 83df2bf9e6b..c22600909bf 100644
--- a/sys-libs/glibc/glibc-2.27-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r1.ebuild
@@ -648,13 +648,19 @@ sanity_prechecks() {
 	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
 	# we test for...
 	if ! is_crosscompile ; then
-
 		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
 			ebegin "Checking that IA32 emulation is enabled in the running kernel"
 			echo 'int main(){return 0;}' > "${T}/check-ia32-emulation.c"
-			"${CC-${CHOST}-gcc}" ${CFLAGS_x86} "${T}/check-ia32-emulation.c" -o "${T}/check-ia32-emulation.elf32"
-			"${T}/check-ia32-emulation.elf32"
-			local STAT=$?
+			local STAT
+			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
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
 			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ec4e7fdcfb1..d70a1523ed9 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -648,13 +648,19 @@ sanity_prechecks() {
 	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
 	# we test for...
 	if ! is_crosscompile ; then
-
 		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
 			ebegin "Checking that IA32 emulation is enabled in the running kernel"
 			echo 'int main(){return 0;}' > "${T}/check-ia32-emulation.c"
-			"${CC-${CHOST}-gcc}" ${CFLAGS_x86} "${T}/check-ia32-emulation.c" -o "${T}/check-ia32-emulation.elf32"
-			"${T}/check-ia32-emulation.elf32"
-			local STAT=$?
+			local STAT
+			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
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
 			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-03  1:38 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-02-03  1:38 UTC (permalink / raw
  To: gentoo-commits

commit:     c2780ee2723e1bd764ffd82214b16bceb41aa385
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  3 01:25:23 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Feb  3 01:25:23 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c2780ee2

Revert "sys-libs/glibc: Hard-die in 2.27 as something's broken in amd64 multilib"

This reverts commit a659d0f75880deedde3dce046a7deb64f4f62f29.

Should be fixed by commit 3a2f034415d6e9c5c0135136b4e28698f3a15767
"sys-libs/glibc: unbreak installation of non-default ABIs, bug #646424"

 sys-libs/glibc/glibc-2.27-r1.ebuild | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.27-r1.ebuild b/sys-libs/glibc/glibc-2.27-r1.ebuild
index 4cb91870ba2..531dbbd5534 100644
--- a/sys-libs/glibc/glibc-2.27-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r1.ebuild
@@ -704,8 +704,6 @@ sanity_prechecks() {
 # pkg_pretend
 
 pkg_pretend() {
-	die "DONT TRY TO USE; BROKEN ON AMD64 MULTILIB."
-
 	# All the checks...
 	einfo "Checking general environment sanity."
 	sanity_prechecks


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-03  1:38 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-02-03  1:38 UTC (permalink / raw
  To: gentoo-commits

commit:     cb46887f4a09108a38d383295c357d786df210c3
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  3 01:30:07 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Feb  3 01:30:07 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cb46887f

sys-libs/glibc: cleanup: use [[, not [

Package-Manager: Portage-2.3.20, Repoman-2.3.6

 sys-libs/glibc/glibc-2.27-r1.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.27-r1.ebuild b/sys-libs/glibc/glibc-2.27-r1.ebuild
index 531dbbd5534..83df2bf9e6b 100644
--- a/sys-libs/glibc/glibc-2.27-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r1.ebuild
@@ -657,7 +657,7 @@ sanity_prechecks() {
 			local STAT=$?
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
-			[ $STAT -eq 0 ] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
 		fi
 
 	fi

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 3903ddf0d1b..ec4e7fdcfb1 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -657,7 +657,7 @@ sanity_prechecks() {
 			local STAT=$?
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
-			[ $STAT -eq 0 ] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
 		fi
 
 	fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-06 21:37 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-02-06 21:37 UTC (permalink / raw
  To: gentoo-commits

commit:     735a56979b7cd06cc57f236ab40fa0c04407cfff
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  6 21:37:22 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Feb  6 21:37:36 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=735a5697

sys-libs/glibc: unbreak cross-compilation

do_run_test() was called unconditionally for all CBUILD/CHOST/CTARGET
combinations. This broke pkg_setup() for cross-*/glibc ebuild.

Change moves do_run_test() back under native guard.

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 sys-libs/glibc/glibc-2.27-r1.ebuild | 12 ++++++------
 sys-libs/glibc/glibc-9999.ebuild    | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.27-r1.ebuild b/sys-libs/glibc/glibc-2.27-r1.ebuild
index c22600909bf..2d395119b4b 100644
--- a/sys-libs/glibc/glibc-2.27-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r1.ebuild
@@ -599,6 +599,12 @@ sanity_prechecks() {
 			eerror " Downgrading glibc is not supported and a sure way to destruction."
 			die "Aborting to save your system."
 		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
 	fi
 
 	# Users have had a chance to phase themselves, time to give em the boot
@@ -615,12 +621,6 @@ sanity_prechecks() {
 		die "Please fix your CHOST"
 	fi
 
-	if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-		eerror "Your old kernel is broken. You need to update it to a newer"
-		eerror "version as syscall(<bignum>) will break. See bug 279260."
-		die "Old and broken kernel."
-	fi
-
 	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
 		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
 		ewarn "This will result in a 50% performance penalty when running with a 32bit"

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index d70a1523ed9..a3f9c3f2edc 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -599,6 +599,12 @@ sanity_prechecks() {
 			eerror " Downgrading glibc is not supported and a sure way to destruction."
 			die "Aborting to save your system."
 		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
 	fi
 
 	# Users have had a chance to phase themselves, time to give em the boot
@@ -615,12 +621,6 @@ sanity_prechecks() {
 		die "Please fix your CHOST"
 	fi
 
-	if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-		eerror "Your old kernel is broken. You need to update it to a newer"
-		eerror "version as syscall(<bignum>) will break. See bug 279260."
-		die "Old and broken kernel."
-	fi
-
 	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
 		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
 		ewarn "This will result in a 50% performance penalty when running with a 32bit"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-08 21:48 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-02-08 21:48 UTC (permalink / raw
  To: gentoo-commits

commit:     cefbe341bc31fa3fdfc767a125f6f40d81241884
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  8 21:48:09 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Feb  8 21:48:09 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cefbe341

sys-libs/glibc: rpcgen is not used here anymore, so no need for special treatment at abi migration

Closes: https://bugs.gentoo.org/644700
Package-Manager: Portage-2.3.21, Repoman-2.3.6

 sys-libs/glibc/glibc-2.26-r5.ebuild | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r5.ebuild b/sys-libs/glibc/glibc-2.26-r5.ebuild
index ca34027cda7..798f8ad6305 100644
--- a/sys-libs/glibc/glibc-2.26-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r5.ebuild
@@ -449,9 +449,6 @@ glibc_do_configure() {
 		echo 'main(){}' > "${T}"/test.c
 		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
 			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-			mkdir -p sunrpc
-			cp $(which rpcgen) sunrpc/cross-rpcgen || die
-			touch -t 202001010101 sunrpc/cross-rpcgen || die
 		fi
 	fi
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-08 23:50 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-02-08 23:50 UTC (permalink / raw
  To: gentoo-commits

commit:     fa2244fedca8e63902ba8d879dbf0f4d9548d754
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  8 23:49:17 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Feb  8 23:49:40 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fa2244fe

sys-libs/glibc: Revbump 2.26-r6 with next patchset (patchlevel 6)

10 test failures need investigating:
===
FAIL: elf/tst-prelink-cmp
XPASS: elf/tst-protected1a
XPASS: elf/tst-protected1b
FAIL: malloc/tst-malloc-tcache-leak
FAIL: math/test-float128-finite-tgamma
FAIL: math/test-float128-finite-trunc
FAIL: math/test-float128-tgamma
FAIL: math/test-float128-trunc
FAIL: math/test-ifloat128-tgamma
FAIL: math/test-ifloat128-trunc
FAIL: misc/tst-ttyname
UNSUPPORTED: nptl/test-cond-printers
UNSUPPORTED: nptl/test-condattr-printers
UNSUPPORTED: nptl/test-mutex-printers
UNSUPPORTED: nptl/test-mutexattr-printers
UNSUPPORTED: nptl/test-rwlock-printers
UNSUPPORTED: nptl/test-rwlockattr-printers
FAIL: nss/tst-nss-files-hosts-multi
Summary of test results:
     10 FAIL
   4113 PASS
      6 UNSUPPORTED
     29 XFAIL
      2 XPASS
===

Bug: https://bugs.gentoo.org/646492
Bug: https://bugs.gentoo.org/646490
Bug: https://bugs.gentoo.org/641644
Bug: https://bugs.gentoo.org/644278
Package-Manager: Portage-2.3.21, Repoman-2.3.6

 sys-libs/glibc/Manifest             |   1 +
 sys-libs/glibc/glibc-2.26-r6.ebuild | 836 ++++++++++++++++++++++++++++++++++++
 2 files changed, 837 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 78d5765e530..650786e1209 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,6 +17,7 @@ DIST glibc-2.25-patches-12.tar.bz2 65396 BLAKE2B b23d5d681314c03b8dd5ad20516324c
 DIST glibc-2.25-patches-13.tar.bz2 71481 BLAKE2B bf5691afabf03b579b8d634da30a2a967ab62d5e470a23b0946ff3354aa974b3b65821aca2f33dd30dd864a82459f4750178bf6ae01a5117ccfde62efd8f594e SHA512 7c80e4aba9edf0310e1707b03a6945f657d71267a4d0d67c24b979c841544a6a623d7c2dbb0a0d55863e25831439d717d096ecf377f936b731baeb04f21704a7
 DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
 DIST glibc-2.26-patches-5.tar.bz2 357699 BLAKE2B 98a0cb231bf35a132747f1fa6e654a9ad2eff8b445f002a0239c9a45f5a896ad490570aedee2b43e6cfa94794ae5c8b5e312e369838c3770823f28b61b51b592 SHA512 0040469e4a85f5c2aac972e42aeb06b0adfc3a132b32b19306be9f1877339fe6651a2fbd4d90d502b07ae4460f74efbd1cd103d38a2038df9402b0a380f03c2a
+DIST glibc-2.26-patches-6.tar.bz2 413639 BLAKE2B 51853dcfd6237a1abcf233e339cc32cfc9d1f9e4d35360971d7dcc95161dc020d6e36e2ba683cb571d3a23e935ce0186da0640c2290de44018c3526dd1de000c SHA512 728d9cf98f48084c9a23e948e7446b6f748db4d57abb0045cf09c2ad847912256a7b1fed16b2f85bb4bb80878ce3485bbd6a311ec7aa0921550f3b357db4c304
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
 DIST glibc-2.27-patches-1.tar.bz2 15950 BLAKE2B ef2d2ede447b98c5e20f1bf1328f1379fd781b603a888f0fd7f1dbb6172e42222c9198d61dd75d9aafbed5c395a277a3c0d00ef4b70932fafb500b111e013963 SHA512 9e3ed7e271313c104eefcd383e6259c235b4e2f7a41be2ba8a1bfb469f8f54835ffde63ae89fa40af47b444911addb0db002a05d033bcc2832710b51650c91e3
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147

diff --git a/sys-libs/glibc/glibc-2.26-r6.ebuild b/sys-libs/glibc/glibc-2.26-r6.ebuild
new file mode 100644
index 00000000000..509801b287d
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.26-r6.ebuild
@@ -0,0 +1,836 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit prefix toolchain-glibc
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+
+# Gentoo patchset
+PATCH_VER=6
+
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
+
+IUSE="audit caps debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
+
+# Min kernel version glibc requires
+: ${NPTL_KERN_VER:="3.2.0"}
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	doc? ( sys-apps/texinfo )
+"
+RDEPEND="${COMMON_DEPEND}
+	!sys-kernel/ps3-sources
+	sys-apps/gentoo-functions
+	!sys-libs/nss-db
+"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.9
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.9
+		virtual/os-headers
+	"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# the phases
+#
+
+pkg_pretend() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ ${ROOT} == "/" ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+		# The high rev # is to allow people to downgrade between -r# versions.
+		# We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine.
+		# Hopefully we never actually use a r# this high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction"
+			die "Aborting to save your system"
+		fi
+
+		if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
+		then
+			eerror "Your patched vendor kernel is broken.  You need to get an"
+			eerror "update from whoever is providing the kernel to you."
+			eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227"
+			eerror "https://bugs.gentoo.org/262698"
+			die "Keeping your system alive, say thank you"
+		fi
+
+		if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
+		then
+			eerror "Your old kernel is broken.  You need to update it to"
+			eerror "a newer version as syscall(<bignum>) will break."
+			eerror "https://bugs.gentoo.org/279260"
+			die "Keeping your system alive, say thank you"
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	use hardened && ! tc-enables-pie && \
+		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
+
+	# Make sure host system is up to date #394453
+	if has_version '<sys-libs/glibc-2.13' && \
+	   [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]]
+	then
+		ebegin "Scanning system for __guard to see if you need to rebuild first ..."
+		local files=$(
+			scanelf -qys__guard -F'#s%F' \
+				"${EROOT}"/*bin/ \
+				"${EROOT}"/lib* \
+				"${EROOT}"/usr/*bin/ \
+				"${EROOT}"/usr/lib* | \
+				egrep -v \
+					-e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \
+					-e "^${EROOT}/sbin/(ldconfig|sln)$"
+		)
+		[[ -z ${files} ]]
+		if ! eend $? ; then
+			eerror "Your system still has old SSP __guard symbols.  You need to"
+			eerror "rebuild all the packages that provide these files first:"
+			eerror "${files}"
+			die "old __guard detected"
+		fi
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+}
+
+src_unpack() {
+	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+
+	setup_env
+
+	# Check NPTL support _before_ we unpack things to save some time
+	check_nptl_support
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${S}"
+	touch locale/C-translit.h #185476 #218003
+
+	cd "${WORKDIR}"
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	if just_headers ; then
+		if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
+			# mips peeps like to screw with us.  if building headers,
+			# we don't have a real compiler, so we can't let them
+			# insert -mabi on us.
+			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
+			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
+		fi
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+
+	if use hardened ; then
+		# We don't enable these for non-hardened as the output is very terse --
+		# it only states that a crash happened.  The default upstream behavior
+		# includes backtraces and symbols.
+		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
+
+		if use debug ; then
+			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+			sed -i \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				debug/Makefile || die
+		fi
+	fi
+}
+
+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 $1"
+
+	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 ; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+
+	# The glibc configure script doesn't properly use LDFLAGS all the time.
+	export CC="$(tc-getCC ${CTARGET}) ${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)"
+	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
+
+	echo
+
+	local myconf=()
+
+	# set addons
+	pushd "${S}" > /dev/null
+	local addons=$(echo */configure | sed \
+		-e 's:/configure::g' \
+		-e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
+		-e 's: \+$::' \
+		-e 's! !,!g' \
+		-e 's!^!,!' \
+		-e '/^,\*$/d')
+	[[ -d ports ]] && addons+=",ports"
+	popd > /dev/null
+
+	case ${CTARGET} in
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=all )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	if [[ $1 == "nptl" ]] ; then
+		myconf+=( --enable-kernel=${NPTL_KERN_VER} )
+	else
+		die "invalid pthread option"
+	fi
+	myconf+=( --enable-add-ons="${addons#,}" )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		--sysconfdir="${EPREFIX}/etc"
+		--localstatedir="${EPREFIX}/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(in_iuse systemtap && use_enable systemtap)
+		$(in_iuse nscd && use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="${EPREFIX}/sbin"
+	export libc_cv_slibdir="${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 "$1")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		${EXTRA_ECONF}
+	)
+
+	local addons
+	[[ -d ${S}/ports ]] && addons+=",ports"
+	myconf+=( --enable-add-ons="${addons#,}" )
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	CC="$(tc-getBUILD_CC)" \
+	CFLAGS="-O1 -pipe" \
+	CPPFLAGS="-U_FORTIFY_SOURCE" \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir $1)"
+	emake -j1 check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test nptl
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}$(alt_prefix)" install || die
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if in_iuse suid && ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		cd "${ED}"$(alt_libdir)/..
+		[[ -e lib ]] || mkdir lib
+		cd "${ED}"$(alt_usrlibdir)/..
+		[[ -e lib ]] || mkdir lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+	src_strip
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ ${ROOT} != "/" ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+	fi
+
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		# if the host locales.gen contains no entries, we'll install everything
+		local locale_list="${EROOT}etc/locale.gen"
+		if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+			ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+			locale_list="${EROOT}usr/share/i18n/SUPPORTED"
+		fi
+		locale-gen -j $(makeopts_jobs) --config "${locale_list}"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-09  9:01 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2018-02-09  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     a83936d543a480a9ff3ce904ae7d75a74a398ca3
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  9 09:01:10 2018 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Fri Feb  9 09:01:10 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a83936d5

sys-libs/glibc: amd64 stable wrt bug #647062

Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>
Package-Manager: Portage-2.3.19, Repoman-2.3.6
RepoMan-Options: --include-arches="amd64"

 sys-libs/glibc/glibc-2.25-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r10.ebuild b/sys-libs/glibc/glibc-2.25-r10.ebuild
index 89b89e76240..60207d18911 100644
--- a/sys-libs/glibc/glibc-2.25-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r10.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-09 21:59 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-02-09 21:59 UTC (permalink / raw
  To: gentoo-commits

commit:     e5061de63123407e56e2c37ca21ca48e88de770f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  9 21:59:16 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Feb  9 21:59:35 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5061de6

sys-libs/glibc: Increase 2.26 patchlevel to 7. Only changes to test suite.

Disable tests misc/tst-ttyname (broken by sandbox) and nss/tst-nss-files-hosts-multi
(broken by local revert).
There are no test regressions compared to 2.26-r5 on amd64-multilib. The float128
failures are a bit strange though.

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 sys-libs/glibc/Manifest             | 2 +-
 sys-libs/glibc/glibc-2.26-r6.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 650786e1209..1b8bb3cbd66 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,7 +17,7 @@ DIST glibc-2.25-patches-12.tar.bz2 65396 BLAKE2B b23d5d681314c03b8dd5ad20516324c
 DIST glibc-2.25-patches-13.tar.bz2 71481 BLAKE2B bf5691afabf03b579b8d634da30a2a967ab62d5e470a23b0946ff3354aa974b3b65821aca2f33dd30dd864a82459f4750178bf6ae01a5117ccfde62efd8f594e SHA512 7c80e4aba9edf0310e1707b03a6945f657d71267a4d0d67c24b979c841544a6a623d7c2dbb0a0d55863e25831439d717d096ecf377f936b731baeb04f21704a7
 DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
 DIST glibc-2.26-patches-5.tar.bz2 357699 BLAKE2B 98a0cb231bf35a132747f1fa6e654a9ad2eff8b445f002a0239c9a45f5a896ad490570aedee2b43e6cfa94794ae5c8b5e312e369838c3770823f28b61b51b592 SHA512 0040469e4a85f5c2aac972e42aeb06b0adfc3a132b32b19306be9f1877339fe6651a2fbd4d90d502b07ae4460f74efbd1cd103d38a2038df9402b0a380f03c2a
-DIST glibc-2.26-patches-6.tar.bz2 413639 BLAKE2B 51853dcfd6237a1abcf233e339cc32cfc9d1f9e4d35360971d7dcc95161dc020d6e36e2ba683cb571d3a23e935ce0186da0640c2290de44018c3526dd1de000c SHA512 728d9cf98f48084c9a23e948e7446b6f748db4d57abb0045cf09c2ad847912256a7b1fed16b2f85bb4bb80878ce3485bbd6a311ec7aa0921550f3b357db4c304
+DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b217391156f897a8db50f65a69627d8f8cceded78414168986ee98eba038364a6b2f3599b23f95e7b0ad2643481c399718 SHA512 0c812a343fcc68c10d92117cb2a0cf1c255470e81f0a7a04d6db2fe35445e410ef37f15162f145c2eb772b08ab55af246f5b52f5e57c2e91038181f6f027abc3
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
 DIST glibc-2.27-patches-1.tar.bz2 15950 BLAKE2B ef2d2ede447b98c5e20f1bf1328f1379fd781b603a888f0fd7f1dbb6172e42222c9198d61dd75d9aafbed5c395a277a3c0d00ef4b70932fafb500b111e013963 SHA512 9e3ed7e271313c104eefcd383e6259c235b4e2f7a41be2ba8a1bfb469f8f54835ffde63ae89fa40af47b444911addb0db002a05d033bcc2832710b51650c91e3
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147

diff --git a/sys-libs/glibc/glibc-2.26-r6.ebuild b/sys-libs/glibc/glibc-2.26-r6.ebuild
index 509801b287d..172a96d333f 100644
--- a/sys-libs/glibc/glibc-2.26-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r6.ebuild
@@ -27,7 +27,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER="4.7.3-r1"
 
 # Gentoo patchset
-PATCH_VER=6
+PATCH_VER=7
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-10  0:32 Thomas Deutschmann
  0 siblings, 0 replies; 1076+ messages in thread
From: Thomas Deutschmann @ 2018-02-10  0:32 UTC (permalink / raw
  To: gentoo-commits

commit:     8e7183eaadf23fd3cf4ecf2a9ef8f84604883f64
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 10 00:16:59 2018 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sat Feb 10 00:16:59 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8e7183ea

sys-libs/glibc: x86 stable (bug #647062)

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 sys-libs/glibc/glibc-2.25-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r10.ebuild b/sys-libs/glibc/glibc-2.25-r10.ebuild
index 60207d18911..c24a5861d63 100644
--- a/sys-libs/glibc/glibc-2.25-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r10.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-10  9:25 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-02-10  9:25 UTC (permalink / raw
  To: gentoo-commits

commit:     eaf922ce1412774e037ff63c3b5b45b24a329b74
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 10 09:22:56 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Feb 10 09:22:56 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eaf922ce

sys-libs/glibc: stable 2.25-r10 for hppa/ia64, bug #647062

Package-Manager: Portage-2.3.24, Repoman-2.3.6
RepoMan-Options: --include-arches="hppa ia64"

 sys-libs/glibc/glibc-2.25-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r10.ebuild b/sys-libs/glibc/glibc-2.25-r10.ebuild
index c24a5861d63..7d2289d9f74 100644
--- a/sys-libs/glibc/glibc-2.25-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r10.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
+KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-10 15:39 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-02-10 15:39 UTC (permalink / raw
  To: gentoo-commits

commit:     468231cb7782dffb5cc544908de6d13cc25d0985
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 10 15:38:44 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Feb 10 15:39:02 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=468231cb

sys-libs/glibc: Allow parallel testing again, otherwise it's just too painful(tm)

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 sys-libs/glibc/glibc-2.26-r6.ebuild | 2 +-
 sys-libs/glibc/glibc-2.27-r1.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r6.ebuild b/sys-libs/glibc/glibc-2.26-r6.ebuild
index 172a96d333f..a812ff3c43c 100644
--- a/sys-libs/glibc/glibc-2.26-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r6.ebuild
@@ -567,7 +567,7 @@ src_compile() {
 
 glibc_src_test() {
 	cd "$(builddir $1)"
-	emake -j1 check
+	emake check
 }
 
 do_src_test() {

diff --git a/sys-libs/glibc/glibc-2.27-r1.ebuild b/sys-libs/glibc/glibc-2.27-r1.ebuild
index 2d395119b4b..e60cc38856b 100644
--- a/sys-libs/glibc/glibc-2.27-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r1.ebuild
@@ -1057,7 +1057,7 @@ src_compile() {
 
 glibc_src_test() {
 	cd "$(builddir nptl)"
-	emake -j1 check
+	emake check
 }
 
 do_src_test() {

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a3f9c3f2edc..9b520f69131 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1057,7 +1057,7 @@ src_compile() {
 
 glibc_src_test() {
 	cd "$(builddir nptl)"
-	emake -j1 check
+	emake check
 }
 
 do_src_test() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-10 19:16 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-02-10 19:16 UTC (permalink / raw
  To: gentoo-commits

commit:     3951b21693a831bd051c1059f179a7bbb3b59042
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Sat Feb 10 18:40:02 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Feb 10 19:16:35 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3951b216

sys-libs/glibc: stable 2.25-r10 for sparc, bug #647062

Package-Manager: Portage-2.3.19, Repoman-2.3.6
RepoMan-Options: --include-arches="sparc"

 sys-libs/glibc/glibc-2.25-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r10.ebuild b/sys-libs/glibc/glibc-2.25-r10.ebuild
index 7d2289d9f74..2924a5a8914 100644
--- a/sys-libs/glibc/glibc-2.25-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r10.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
+KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-10 19:57 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-02-10 19:57 UTC (permalink / raw
  To: gentoo-commits

commit:     ad99a787ed3e2ef6b22f7ae903e4ba7d81c4b6c3
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 10 19:57:25 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Feb 10 19:57:31 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ad99a787

sys-libs/glibc: stable 2.25-r10 for ppc/ppc64, bug #647062

Package-Manager: Portage-2.3.24, Repoman-2.3.6
RepoMan-Options: --include-arches="ppc ppc64"

 sys-libs/glibc/glibc-2.25-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r10.ebuild b/sys-libs/glibc/glibc-2.25-r10.ebuild
index 2924a5a8914..1328723fe74 100644
--- a/sys-libs/glibc/glibc-2.25-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r10.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh sparc x86"
+KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-02-14 21:51 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-02-14 21:51 UTC (permalink / raw
  To: gentoo-commits

commit:     16a5a1be38c43981e523ef7696c9b5c28d8d05df
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 14 21:51:22 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Feb 14 21:51:22 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=16a5a1be

sys-libs/glibc: Re-add keywords to 2.26-r6

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 sys-libs/glibc/glibc-2.26-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r6.ebuild b/sys-libs/glibc/glibc-2.26-r6.ebuild
index a812ff3c43c..e04e8dd3621 100644
--- a/sys-libs/glibc/glibc-2.26-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r6.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-03-02  9:38 Mart Raudsepp
  0 siblings, 0 replies; 1076+ messages in thread
From: Mart Raudsepp @ 2018-03-02  9:38 UTC (permalink / raw
  To: gentoo-commits

commit:     7f11c776d8881261d364dc98173a013a3c7e581b
Author:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
AuthorDate: Fri Mar  2 09:37:38 2018 +0000
Commit:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
CommitDate: Fri Mar  2 09:37:38 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7f11c776

sys-libs/glibc-2.25-r10: arm64 stable (bug #647062)

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-2.25-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r10.ebuild b/sys-libs/glibc/glibc-2.25-r10.ebuild
index 1328723fe74..128bcf1085b 100644
--- a/sys-libs/glibc/glibc-2.25-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r10.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
+KEYWORDS="~alpha amd64 ~arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-03-03 17:56 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-03-03 17:56 UTC (permalink / raw
  To: gentoo-commits

commit:     3dc5d06a6fc7770c792d476096a32d0fb8b1e4b4
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Mar  3 17:54:31 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Mar  3 17:56:09 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3dc5d06a

sys-libs/glibc: bump 2.25 with patchset 14

5 new patches:

$ git log --oneline gentoo/glibc-2.25-13..gentoo/glibc-2.25-14 | cat
5c90b3f269 mutex: Fix robust mutex lock acquire (Bug 21778)
a98b916d44 locale-gen: suppress ignored error when emptying already empty directory
bdfd212eed Fix integer overflows in internal memalign and malloc [BZ #22343] [BZ #22774]
f4f6d1886b elf: Check for empty tokens before dynamic string token expansion [BZ #22625]
134fb1be78 linux: make getcwd(3) fail if it cannot obtain an absolute path [BZ #22679]

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 sys-libs/glibc/Manifest              |   1 +
 sys-libs/glibc/glibc-2.25-r11.ebuild | 154 +++++++++++++++++++++++++++++++++++
 2 files changed, 155 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 1b8bb3cbd66..89e3d72f6fb 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,6 +15,7 @@ DIST glibc-2.24-patches-10.tar.bz2 73586 BLAKE2B f42cc78b907e7cb5c8ba1672c845cdc
 DIST glibc-2.24.tar.xz 13554048 BLAKE2B 9f93ac00f68eb88e3a2272752624163fac25dd064170e336143aa697908fba2b27ed926582f978da99c6c2489c0ce34d3eb266b5d00be69d27b36126bc2c8efb SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb
 DIST glibc-2.25-patches-12.tar.bz2 65396 BLAKE2B b23d5d681314c03b8dd5ad20516324c1ce5b24deb4d9ce03970dce97b524ee9d3f5d5463f2d6b7693e4c9ef25d006847f960993f55ca082fc961268d05f937ca SHA512 6af8c304ba70b42dfda294873d9a138d6c98e7a46496e305b2cac99a085d1ad3d00315162d1e1458e651de95e158bd35be74406a3f44fde13182e30baa663fcb
 DIST glibc-2.25-patches-13.tar.bz2 71481 BLAKE2B bf5691afabf03b579b8d634da30a2a967ab62d5e470a23b0946ff3354aa974b3b65821aca2f33dd30dd864a82459f4750178bf6ae01a5117ccfde62efd8f594e SHA512 7c80e4aba9edf0310e1707b03a6945f657d71267a4d0d67c24b979c841544a6a623d7c2dbb0a0d55863e25831439d717d096ecf377f936b731baeb04f21704a7
+DIST glibc-2.25-patches-14.tar.bz2 78564 BLAKE2B 5ec6d5178c56a2cdcf7f231b0fd28d6e7dbd152eb7f937357b7486ddefc8371c16e6d55ba5ad65d1fcb0cef2b5dbe7e2a4bc220402ab3b388f0748b99ccb9836 SHA512 50ad28d15294cf551cab8040974a090681e14d28e3ab707425f54ea85661e64a1fc5a3809cd7d0ecfd531a28e2e54e45bf4a5d0e0725088eeed7e6e7c983573a
 DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
 DIST glibc-2.26-patches-5.tar.bz2 357699 BLAKE2B 98a0cb231bf35a132747f1fa6e654a9ad2eff8b445f002a0239c9a45f5a896ad490570aedee2b43e6cfa94794ae5c8b5e312e369838c3770823f28b61b51b592 SHA512 0040469e4a85f5c2aac972e42aeb06b0adfc3a132b32b19306be9f1877339fe6651a2fbd4d90d502b07ae4460f74efbd1cd103d38a2038df9402b0a380f03c2a
 DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b217391156f897a8db50f65a69627d8f8cceded78414168986ee98eba038364a6b2f3599b23f95e7b0ad2643481c399718 SHA512 0c812a343fcc68c10d92117cb2a0cf1c255470e81f0a7a04d6db2fe35445e410ef37f15162f145c2eb772b08ab55af246f5b52f5e57c2e91038181f6f027abc3

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
new file mode 100644
index 00000000000..1fb31b72699
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -0,0 +1,154 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit toolchain-glibc
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+#TODO: restore keywords after minimal testing.
+#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+case ${PV} in
+9999*)
+	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+	EGIT_SOURCEDIRS="${S}"
+	inherit git-2
+	;;
+*)
+	RELEASE_VER=${PV}
+	;;
+esac
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
+PATCH_VER="14"                                 # Gentoo patchset
+: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
+
+GLIBC_PATCH_EXCLUDE+=" 0005_all_sys-types.h-drop-sys-sysmacros.h-include.patch"
+
+IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2"
+RDEPEND="${COMMON_DEPEND}
+	!sys-kernel/ps3-sources
+	sys-apps/gentoo-functions
+	!sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.7
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.7
+		virtual/os-headers"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+	local devspace="HTTP~vapier/dist/URI HTTP~dilfridge/distfiles/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
+	devspace=${devspace//HTTP/https://dev.gentoo.org/}
+	echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+src_unpack() {
+	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+
+	toolchain-glibc_src_unpack
+}
+
+src_prepare() {
+	toolchain-glibc_src_prepare
+
+	cd "${S}"
+
+	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
+
+	if use hardened ; then
+		# We don't enable these for non-hardened as the output is very terse --
+		# it only states that a crash happened.  The default upstream behavior
+		# includes backtraces and symbols.
+		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
+
+		if use debug ; then
+			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+			sed -i \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				debug/Makefile || die
+		fi
+	fi
+
+	case $(gcc-fullversion) in
+	4.8.[0-3]|4.9.0)
+		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
+		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
+		die "need to switch compilers #547420"
+		;;
+	esac
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-03-04 21:40 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-03-04 21:40 UTC (permalink / raw
  To: gentoo-commits

commit:     e824c2a3d34829c7e6b45bcbd33896eeb1ef8afa
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  4 21:40:36 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Mar  4 21:40:48 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e824c2a3

sys-libs/glibc: Add 2.19 revbump with patchset generated from git and EAPI=6

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.19-r2.ebuild | 1393 +++++++++++++++++++++++++++++++++++
 2 files changed, 1394 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 89e3d72f6fb..f57813fb1a3 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -2,6 +2,7 @@ DIST gcc-4.7.3-r1-multilib-bootstrap.tar.bz2 8064097 BLAKE2B 3cc5c82cd57d0fbd26d
 DIST glibc-2.18-patches-4.tar.bz2 95165 BLAKE2B 70280e0f5fd0b1ee13cd0464aafaa9c9324528d0bee8024e6529d67d908991012066db6d8257b66983a1f52e32b3aad7718612fdab9ea199fef845db93347168 SHA512 d881c9c5fe32b967694d4ca5185ff5ffc964449f2ed49fd062e5d57a3c6d9f16eef2f591d2d8e98a1a95a6487f3436ef031839ed8766fd085404b288340b7933
 DIST glibc-2.18.tar.xz 11150148 BLAKE2B 7848a5a50abedbd17085e05b6f6835959adb5e55a424d95fa8a49eeec999a6dd81a9382db85ef7e852ef1d7743c5d312dccbf42024e95edf0e802eb32928dfe5 SHA512 27218d2e7dd3bf3908d7af171c490933680e958c579ebd27b43b661e223fd5de2219cc1cf699170405280808c84de476d0ad86dbba35a488ef404e9438552327
 DIST glibc-2.19-patches-3.tar.bz2 80664 BLAKE2B fb348c711941c1bd4dadd905e172dc4f239d8b63af1a1d14dcf4ec45c504bd47e10e9b24b38f9e01796016f2e97caeeb693213ae08147274ed0a4d9501293be0 SHA512 d281d6a2757920124cf8a3f02b97e75192598b08d96ae48840df34c7ffdcb212952d171f233e6f12a429b19437d0a296212fe1f2eae164d6a1c6793cb3cb69f0
+DIST glibc-2.19-patches-9.tar.bz2 24584 BLAKE2B a96e930a5bd20fa75d9f259cc2117fa5ce98072274a24a5823bf877e3739fa4c001a94d7865e065ee0527f3974430d27da8038e042340a451ad2052c62724f26 SHA512 a95b3063ade974a3556480b798b317d33c7423a8cb9e69f67249ffb8b3d3c671d70d2d5f782c1efadc0bec4cc49a96d4fe89911f3dfcd85b459f69f3b4f38f0e
 DIST glibc-2.19.tar.xz 12083312 BLAKE2B 9dc03346e0f0df4bf009a92d894b0a9f964ff92b7f4c9663cedf1cb6cf90435f28a15539d33791ecf43ee578fa4e26f916af0367651312ef8f9c1c38ce0dafa2 SHA512 9e021fcb3afbb9ace2a0e37fded231a62de861bd766e29d47163a03182e37add718b7acc3963d1c525f9556773e842297725715acde48dcfbaab6e756af1a23d
 DIST glibc-2.20-patches-5.tar.bz2 55986 BLAKE2B bad714bd088fb8759ee84d33f22c0bba01a78a401c54828dc413c7ac2a08ae53fba9b07280996e54091f2c918658bb502aeb45f734022c1ab36e1be215381324 SHA512 409f59a028127e02f0c9f91107715b540d8d234475830adc17108a02664be232098d119b43bcc8df9b328ab50c1fffb0868d510e6487ce1c34ec2c7c7a78375b
 DIST glibc-2.20.tar.xz 12283992 BLAKE2B f2db06a06e47942e9f5aaad5c4b603d63bb9a3ba624dc1c973e864d65cf893adb7568a18516c0b915b772d2ca30e95899a4d5c03ff9b3ad23e1e276a1d535f39 SHA512 7a8eea8b71d3ccba766c3f304cab61055446d451ef063309476b26dc40d880562dc33b1b68fbedeedb4b55b84c26415b9202311aaa71ef8c141b6849a814d2fa

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
new file mode 100644
index 00000000000..e4a5ff90de6
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -0,0 +1,1393 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	KEYWORDS=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+
+# Gentoo patchset
+PATCH_VER=9
+
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
+
+IUSE="audit caps compile-locales debug doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla"
+
+# Minimum kernel version that glibc requires
+# Everyone except hppa could also use 2.6.16
+MIN_KERN_VER="2.6.20"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	!<sys-devel/bison-2.7
+	doc? ( sys-apps/texinfo )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+	!sys-kernel/ps3-sources
+	!sys-libs/nss-db
+"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.9
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.9
+		virtual/os-headers
+	"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# We need to be able to set alternative headers for compiling for non-native 
+# platform. Will also become useful for testing kernel-headers without screwing 
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake -s glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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' 2>/dev/null ; then
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		amd64)
+			# -march needed for #185404 #199334
+			# Note: This test only matters when the x86 ABI is enabled, so we could
+			# optimize a bit and elide it.
+			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if version_is_at_least 2.8 ; then
+						cpu="sparc64v2"
+					elif version_is_at_least 2.4 ; then
+						cpu="sparc64v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if version_is_at_least 2.4 ; then
+						cpu="sparc64v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if version_is_at_least 2.8 ; then
+						cpu="sparcv9v2"
+					elif version_is_at_least 2.4 ; then
+						cpu="sparcv9v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if version_is_at_least 2.4 ; then
+						cpu="sparcv9v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Over-zealous CFLAGS can often cause problems.  What may work for one
+	# person may not work for another.  To avoid a large influx of bugs
+	# relating to failed builds, we strip most CFLAGS out to ensure as few
+	# problems as possible.
+	strip-flags
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# Lock glibc at -O2; we want to be conservative here.
+	# -fno-strict-aliasing is to work around #155906.
+	filter-flags '-O?'
+	append-flags -O2 -fno-strict-aliasing
+
+	filter-flags '-fstack-protector*'
+
+	# Starting with gcc-6 (and fully upstreamed pie patches) we control
+	# default enabled/disabled pie via use flags. So nothing to do
+	# here then. #618160
+	if [[ $(gcc-major-version) -lt 6 ]]; then
+		if use hardened && tc-enables-pie ; then
+			# Force PIC macro definition for all compilations since they're all
+			# either -fPIC or -fPIE with the default-PIE compiler.
+			append-cppflags -DPIC
+		else
+			# Don't build -fPIE without the default-PIE compiler and the
+			# hardened-pie patch
+			filter-flags -fPIE
+		fi
+	fi
+}
+
+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}
+}
+
+use_multiarch() {
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	version_is_at_least ${nver} ${bver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ ${ROOT} != "/" ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ ${ROOT} == "/" ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	use hardened && ! tc-enables-pie && \
+		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	if ! just_headers ; then
+		local run_kv build_kv want_kv
+
+		run_kv=$(g_get_running_KV)
+		build_kv=$(g_int_to_KV $(get_kheader_version))
+		want_kv=${MIN_KERN_VER}
+
+		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!"
+		fi
+
+		if ! is_crosscompile && ! tc-is-cross-compiler ; then
+			# Building fails on an non-supporting kernel
+			ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+			if ! eend_KV ${run_kv} ${want_kv} ; then
+				echo
+				eerror "You need a kernel of at least ${want_kv}!"
+				die "Kernel version too low!"
+			fi
+		fi
+
+		ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+		if ! eend_KV ${build_kv} ${want_kv} ; then
+			echo
+			eerror "You need linux-headers of at least ${want_kv}!"
+			die "linux-headers version too low!"
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${S}" || die
+	touch locale/C-translit.h || die #185476 #218003
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	if just_headers ; then
+		if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
+			# mips peeps like to screw with us.  if building headers,
+			# we don't have a real compiler, so we can't let them
+			# insert -mabi on us.
+			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
+			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
+		fi
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+
+	if use hardened ; then
+		# We don't enable these for non-hardened as the output is very terse --
+		# it only states that a crash happened.  The default upstream behavior
+		# includes backtraces and symbols.
+		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
+
+		if use debug ; then
+			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+			sed -i \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				debug/Makefile || die
+		fi
+	fi
+}
+
+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 ; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+
+	# The glibc configure script doesn't properly use LDFLAGS all the time.
+	export CC="$(tc-getCC ${CTARGET}) ${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)"
+	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=all )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		--sysconfdir="${EPREFIX}/etc"
+		--localstatedir="${EPREFIX}/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(in_iuse systemtap && use_enable systemtap)
+		$(in_iuse nscd && use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="${EPREFIX}/sbin"
+	export libc_cv_slibdir="${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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	CC="$(tc-getBUILD_CC)" \
+	CFLAGS="-O1 -pipe" \
+	CPPFLAGS="-U_FORTIFY_SOURCE" \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local locale_list="${root}/etc/locale.gen"
+	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+		locale_list="${root}/usr/share/i18n/SUPPORTED"
+	fi
+
+	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}$(alt_prefix)" install || die
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if in_iuse suid && ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		cd "${ED}"$(alt_libdir)/..
+		[[ -e lib ]] || mkdir lib
+		cd "${ED}"$(alt_usrlibdir)/..
+		[[ -e lib ]] || mkdir lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen "${ED}"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_strip() {
+	# gdb is lame and requires some debugging information to remain in
+	# libpthread, so we need to strip it by hand.  libthread_db makes no
+	# sense stripped as it is only used when debugging.
+	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
+	env \
+		-uRESTRICT \
+		CHOST=${CTARGET} \
+		STRIP_MASK="/*/{,tls/}${pthread}*" \
+		prepallstrip
+	# if user has stripping enabled and does not have split debug turned on,
+	# then leave the debugging sections in libpthread.
+	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
+		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"/*/libpthread-*.so
+	fi
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+	src_strip
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ ${ROOT} != "/" ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+	fi
+
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		use compile-locales || run_locale_gen "${EROOT}"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-03-04 21:54 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-03-04 21:54 UTC (permalink / raw
  To: gentoo-commits

commit:     2a1a9fa76173bd7a216e6922820068aeebc37668
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  4 21:54:24 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Mar  4 21:54:24 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2a1a9fa7

sys-libs/glibc: Bump patchset number, so the patches actually apply. My mistake, sorry.

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 sys-libs/glibc/Manifest              | 2 +-
 sys-libs/glibc/glibc-2.25-r11.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index f57813fb1a3..b5b019b4872 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,7 +16,7 @@ DIST glibc-2.24-patches-10.tar.bz2 73586 BLAKE2B f42cc78b907e7cb5c8ba1672c845cdc
 DIST glibc-2.24.tar.xz 13554048 BLAKE2B 9f93ac00f68eb88e3a2272752624163fac25dd064170e336143aa697908fba2b27ed926582f978da99c6c2489c0ce34d3eb266b5d00be69d27b36126bc2c8efb SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb
 DIST glibc-2.25-patches-12.tar.bz2 65396 BLAKE2B b23d5d681314c03b8dd5ad20516324c1ce5b24deb4d9ce03970dce97b524ee9d3f5d5463f2d6b7693e4c9ef25d006847f960993f55ca082fc961268d05f937ca SHA512 6af8c304ba70b42dfda294873d9a138d6c98e7a46496e305b2cac99a085d1ad3d00315162d1e1458e651de95e158bd35be74406a3f44fde13182e30baa663fcb
 DIST glibc-2.25-patches-13.tar.bz2 71481 BLAKE2B bf5691afabf03b579b8d634da30a2a967ab62d5e470a23b0946ff3354aa974b3b65821aca2f33dd30dd864a82459f4750178bf6ae01a5117ccfde62efd8f594e SHA512 7c80e4aba9edf0310e1707b03a6945f657d71267a4d0d67c24b979c841544a6a623d7c2dbb0a0d55863e25831439d717d096ecf377f936b731baeb04f21704a7
-DIST glibc-2.25-patches-14.tar.bz2 78564 BLAKE2B 5ec6d5178c56a2cdcf7f231b0fd28d6e7dbd152eb7f937357b7486ddefc8371c16e6d55ba5ad65d1fcb0cef2b5dbe7e2a4bc220402ab3b388f0748b99ccb9836 SHA512 50ad28d15294cf551cab8040974a090681e14d28e3ab707425f54ea85661e64a1fc5a3809cd7d0ecfd531a28e2e54e45bf4a5d0e0725088eeed7e6e7c983573a
+DIST glibc-2.25-patches-15.tar.bz2 78320 BLAKE2B 70c62cc10db13e2844de4d8a18972e0f4d01ba52fbd40db57c11d7b1c2c0d571b894f01e762bb26632fd696a77c299ef0766e2f129d2eda896f58325a754a13c SHA512 7204218ea82b677e0f278c4752ddb90aa0c08ac2349d061de81ec91dac204b0f10fe223d7b1055b9e0c21dac97c835f913a90c0168a5000d3be00dd20027c185
 DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
 DIST glibc-2.26-patches-5.tar.bz2 357699 BLAKE2B 98a0cb231bf35a132747f1fa6e654a9ad2eff8b445f002a0239c9a45f5a896ad490570aedee2b43e6cfa94794ae5c8b5e312e369838c3770823f28b61b51b592 SHA512 0040469e4a85f5c2aac972e42aeb06b0adfc3a132b32b19306be9f1877339fe6651a2fbd4d90d502b07ae4460f74efbd1cd103d38a2038df9402b0a380f03c2a
 DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b217391156f897a8db50f65a69627d8f8cceded78414168986ee98eba038364a6b2f3599b23f95e7b0ad2643481c399718 SHA512 0c812a343fcc68c10d92117cb2a0cf1c255470e81f0a7a04d6db2fe35445e410ef37f15162f145c2eb772b08ab55af246f5b52f5e57c2e91038181f6f027abc3

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index 1fb31b72699..45016dbcfc9 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -28,7 +28,7 @@ case ${PV} in
 esac
 GCC_BOOTSTRAP_VER="4.7.3-r1"
 # patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="14"                                 # Gentoo patchset
+PATCH_VER="15"                                 # Gentoo patchset
 : ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
 
 GLIBC_PATCH_EXCLUDE+=" 0005_all_sys-types.h-drop-sys-sysmacros.h-include.patch"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-03-05 10:37 Tobias Klausmann
  0 siblings, 0 replies; 1076+ messages in thread
From: Tobias Klausmann @ 2018-03-05 10:37 UTC (permalink / raw
  To: gentoo-commits

commit:     29c56c6787c1bf3171ed883eb4d8bc3a8b3c9f84
Author:     Tobias Klausmann <klausman <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  5 10:37:36 2018 +0000
Commit:     Tobias Klausmann <klausman <AT> gentoo <DOT> org>
CommitDate: Mon Mar  5 10:37:36 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=29c56c67

sys-libs/glibc-2.25-r10: alpha stable

Gentoo-Bug: http://bugs.gentoo.org/647062

 sys-libs/glibc/glibc-2.25-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r10.ebuild b/sys-libs/glibc/glibc-2.25-r10.ebuild
index 128bcf1085b..a286da5e646 100644
--- a/sys-libs/glibc/glibc-2.25-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r10.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha amd64 ~arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
+KEYWORDS="alpha amd64 ~arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-03-11  9:51 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-03-11  9:51 UTC (permalink / raw
  To: gentoo-commits

commit:     de806951fd8255d34c24c7633062365ccf20ab18
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 11 09:50:39 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Mar 11 09:50:58 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de806951

sys-libs/glibc: restore keywords for 2.25-r11

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 sys-libs/glibc/glibc-2.25-r11.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index 45016dbcfc9..898a6cd5f4b 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -9,8 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-#TODO: restore keywords after minimal testing.
-#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-03-15 13:59 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2018-03-15 13:59 UTC (permalink / raw
  To: gentoo-commits

commit:     976fdcf021e7ee91e13e570fe818b85a65f9c9a8
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 15 13:59:03 2018 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Thu Mar 15 13:59:03 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=976fdcf0

sys-libs/glibc: arm stable wrt bug #647062

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 sys-libs/glibc/glibc-2.25-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r10.ebuild b/sys-libs/glibc/glibc-2.25-r10.ebuild
index a286da5e646..9517aa47225 100644
--- a/sys-libs/glibc/glibc-2.25-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r10.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 ~arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-03-22 22:23 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-03-22 22:23 UTC (permalink / raw
  To: gentoo-commits

commit:     34f84bf5487200fb65d772469e0f1cd20c14c9c1
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 22 22:23:02 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Mar 22 22:23:43 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=34f84bf5

sys-libs/glibc: skip real tests for USE=headers-only flavour

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 sys-libs/glibc/glibc-2.26-r6.ebuild | 3 +++
 sys-libs/glibc/glibc-2.27-r1.ebuild | 4 ++++
 sys-libs/glibc/glibc-9999.ebuild    | 3 +++
 3 files changed, 10 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.26-r6.ebuild b/sys-libs/glibc/glibc-2.26-r6.ebuild
index e04e8dd3621..2729cf8d6eb 100644
--- a/sys-libs/glibc/glibc-2.26-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r6.ebuild
@@ -580,6 +580,9 @@ do_src_test() {
 }
 
 src_test() {
+	if just_headers ; then
+		return
+	fi
 	# Give tests more time to complete.
 	export TIMEOUTFACTOR=5
 

diff --git a/sys-libs/glibc/glibc-2.27-r1.ebuild b/sys-libs/glibc/glibc-2.27-r1.ebuild
index e60cc38856b..aa1b179ab4b 100644
--- a/sys-libs/glibc/glibc-2.27-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r1.ebuild
@@ -1070,6 +1070,10 @@ do_src_test() {
 }
 
 src_test() {
+	if just_headers ; then
+		return
+	fi
+
 	# Give tests more time to complete.
 	export TIMEOUTFACTOR=5
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 9b520f69131..a978eaf1970 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1070,6 +1070,9 @@ do_src_test() {
 }
 
 src_test() {
+	if just_headers ; then
+		return
+	fi
 	# Give tests more time to complete.
 	export TIMEOUTFACTOR=5
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-03-29  0:39 Aaron Bauman
  0 siblings, 0 replies; 1076+ messages in thread
From: Aaron Bauman @ 2018-03-29  0:39 UTC (permalink / raw
  To: gentoo-commits

commit:     ae8b946adf706854d33983c35fc76b12f11c9391
Author:     Aaron Bauman <bman <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 29 00:38:20 2018 +0000
Commit:     Aaron Bauman <bman <AT> gentoo <DOT> org>
CommitDate: Thu Mar 29 00:38:20 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ae8b946a

sys-libs/glibc: amd64 stable

Bug: https://bugs.gentoo.org/646492
Package-Manager: Portage-2.3.26, Repoman-2.3.7

 sys-libs/glibc/glibc-2.25-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index 898a6cd5f4b..6a73626ae9c 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-03-29 15:19 Thomas Deutschmann
  0 siblings, 0 replies; 1076+ messages in thread
From: Thomas Deutschmann @ 2018-03-29 15:19 UTC (permalink / raw
  To: gentoo-commits

commit:     84af2f0747e70d0fca8b917bb4b651f2e34d8879
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 29 14:59:36 2018 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Thu Mar 29 15:16:53 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=84af2f07

sys-libs/glibc: x86 stable (bug #646492)

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 sys-libs/glibc/glibc-2.25-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index 6a73626ae9c..c5f4d91855c 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-03-29 19:39 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-03-29 19:39 UTC (permalink / raw
  To: gentoo-commits

commit:     a328966ce3d0fdcbe66ccc30bc7f92c815971b10
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 29 19:39:25 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Mar 29 19:39:30 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a328966c

sys-libs/glibc: stable 2.25-r11 for ia64, bug #646492

Package-Manager: Portage-2.3.26, Repoman-2.3.7
RepoMan-Options: --include-arches="ia64"

 sys-libs/glibc/glibc-2.25-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index c5f4d91855c..24e5f40fa6b 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
+KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-03-29 22:32 Mart Raudsepp
  0 siblings, 0 replies; 1076+ messages in thread
From: Mart Raudsepp @ 2018-03-29 22:32 UTC (permalink / raw
  To: gentoo-commits

commit:     9d17863c2325575d09c4cc31b81609ef0a4a68de
Author:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 29 22:30:06 2018 +0000
Commit:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
CommitDate: Thu Mar 29 22:30:06 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9d17863c

sys-libs/glibc-2.25-r11: arm64 stable (bug #646492)

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-libs/glibc/glibc-2.25-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index 24e5f40fa6b..6e59006fdb5 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
+KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-03-30 11:43 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-03-30 11:43 UTC (permalink / raw
  To: gentoo-commits

commit:     7a505aed3d730685006abdeb6c0ca4f1698bfb76
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 30 11:17:25 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Mar 30 11:43:08 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7a505aed

sys-libs/glibc: log when ebuild overrides CC/CFLAGS

Package-Manager: Portage-2.3.26, Repoman-2.3.7

 sys-libs/glibc/glibc-2.26-r6.ebuild | 17 +++++++++++++----
 sys-libs/glibc/glibc-2.27-r1.ebuild | 19 +++++++++++++++----
 sys-libs/glibc/glibc-9999.ebuild    | 19 +++++++++++++++----
 3 files changed, 43 insertions(+), 12 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r6.ebuild b/sys-libs/glibc/glibc-2.26-r6.ebuild
index 2729cf8d6eb..0922ffb404f 100644
--- a/sys-libs/glibc/glibc-2.26-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r6.ebuild
@@ -532,11 +532,20 @@ glibc_headers_configure() {
 
 	# Nothing is compiled here which would affect the headers for the target.
 	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE"
+	local headers_only_LDFLAGS=""
 	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	CC="$(tc-getBUILD_CC)" \
-	CFLAGS="-O1 -pipe" \
-	CPPFLAGS="-U_FORTIFY_SOURCE" \
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
 	LDFLAGS="" \
 	"$@" || die "failed to configure glibc"
 }

diff --git a/sys-libs/glibc/glibc-2.27-r1.ebuild b/sys-libs/glibc/glibc-2.27-r1.ebuild
index aa1b179ab4b..a175b225e18 100644
--- a/sys-libs/glibc/glibc-2.27-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r1.ebuild
@@ -450,6 +450,7 @@ setup_env() {
 		# and fall back on CFLAGS.
 		local VAR=CFLAGS_${CTARGET//[-.]/_}
 		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
 	fi
 
 	setup_flags
@@ -463,6 +464,7 @@ setup_env() {
 	# top of each other.
 	: ${__GLIBC_CC:=$(tc-getCC ${CTARGET_OPT:-${CTARGET}})}
 	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
 }
 
 foreach_abi() {
@@ -1022,11 +1024,20 @@ glibc_headers_configure() {
 
 	# Nothing is compiled here which would affect the headers for the target.
 	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE"
+	local headers_only_LDFLAGS=""
 	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	CC="$(tc-getBUILD_CC)" \
-	CFLAGS="-O1 -pipe" \
-	CPPFLAGS="-U_FORTIFY_SOURCE" \
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
 	LDFLAGS="" \
 	"$@" || die "failed to configure glibc"
 }

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a978eaf1970..52fe095e5fd 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -450,6 +450,7 @@ setup_env() {
 		# and fall back on CFLAGS.
 		local VAR=CFLAGS_${CTARGET//[-.]/_}
 		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
 	fi
 
 	setup_flags
@@ -463,6 +464,7 @@ setup_env() {
 	# top of each other.
 	: ${__GLIBC_CC:=$(tc-getCC ${CTARGET_OPT:-${CTARGET}})}
 	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
 }
 
 foreach_abi() {
@@ -1022,11 +1024,20 @@ glibc_headers_configure() {
 
 	# Nothing is compiled here which would affect the headers for the target.
 	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE"
+	local headers_only_LDFLAGS=""
 	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	CC="$(tc-getBUILD_CC)" \
-	CFLAGS="-O1 -pipe" \
-	CPPFLAGS="-U_FORTIFY_SOURCE" \
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
 	LDFLAGS="" \
 	"$@" || die "failed to configure glibc"
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-03-30 11:43 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-03-30 11:43 UTC (permalink / raw
  To: gentoo-commits

commit:     bdb069df283ccbe1e3f5fd39bb2270ec640a67b7
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 30 11:41:50 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Mar 30 11:43:08 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bdb069df

sys-libs/glibc: fix glibc-headers bootstrap on non-multilib host

The error is found by wm_ attempting to build a cross-compiler
    CHOST=powerpc-unknown-linux-gnu CTARGET=mips64-unknown-linux-gnu
Boostrap failed on glibc-headers (./configure phase) as:

  configure:2623: powerpc-unknown-linux-gnu-gcc -mabi=n32 -c \
      -O1 -pipe -U_FORTIFY_SOURCE conftest.c >&5
  powerpc-unknown-linux-gnu-gcc: error: \
      unrecognized command line option '-mabi=n32'; did you mean '-mabi=d32'?

Note how target's ABI is mexed into host's compiler flags.

The error above happens on every host=non-multilib target=multilib combination.
I've reproduced it on:
    CHOST=i686-pc-linux-gnu CTARGET=mips64-unknown-linux-gnu

The fix is not to inject target's CFLAGS ABI into CC for
USE=headers-only bootstrap step as we don't have cross-compiler yet.

Tested by successfully bootstrapping cross-compiler on
    CHOST=i686-pc-linux-gnu CTARGET=mips64-unknown-linux-gnu

Package-Manager: Portage-2.3.26, Repoman-2.3.7

 sys-libs/glibc/glibc-2.27-r1.ebuild | 7 +++++++
 sys-libs/glibc/glibc-9999.ebuild    | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.27-r1.ebuild b/sys-libs/glibc/glibc-2.27-r1.ebuild
index a175b225e18..b281c00fac3 100644
--- a/sys-libs/glibc/glibc-2.27-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r1.ebuild
@@ -457,6 +457,13 @@ setup_env() {
 
 	export ABI=${ABI:-${DEFAULT_ABI:-default}}
 
+	if use headers-only ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
 	local VAR=CFLAGS_${ABI}
 	# We need to export CFLAGS with abi information in them because glibc's
 	# configure script checks CFLAGS for some targets (like mips).  Keep

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 52fe095e5fd..17f8cdafed5 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -457,6 +457,13 @@ setup_env() {
 
 	export ABI=${ABI:-${DEFAULT_ABI:-default}}
 
+	if use headers-only ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
 	local VAR=CFLAGS_${ABI}
 	# We need to export CFLAGS with abi information in them because glibc's
 	# configure script checks CFLAGS for some targets (like mips).  Keep


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-03-30 22:37 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-03-30 22:37 UTC (permalink / raw
  To: gentoo-commits

commit:     85db725d1f136424e2e23cd31897df0516ac6b87
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 30 22:37:32 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Mar 30 22:37:51 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=85db725d

sys-libs/glibc: stable 2.25-r11 for ppc64, bug #646492

Package-Manager: Portage-2.3.26, Repoman-2.3.7
RepoMan-Options: --include-arches="ppc64"

 sys-libs/glibc/glibc-2.25-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index 6e59006fdb5..ac21ef496d3 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
+KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ~ppc ppc64 ~s390 ~sh ~sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-03-31 10:05 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-03-31 10:05 UTC (permalink / raw
  To: gentoo-commits

commit:     15068b1c791ece90bbc739feb13044c351fd3710
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Sat Mar 31 08:29:51 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Mar 31 10:04:42 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15068b1c

sys-libs/glibc: stable 2.25-r11 for sparc

Bug: https://bugs.gentoo.org/646492
Package-Manager: Portage-2.3.24, Repoman-2.3.6
RepoMan-Options: --include-arches="sparc"

 sys-libs/glibc/glibc-2.25-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index ac21ef496d3..ffe2773d451 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ~ppc ppc64 ~s390 ~sh ~sparc x86"
+KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ~ppc ppc64 ~s390 ~sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-03-31 14:17 Tobias Klausmann
  0 siblings, 0 replies; 1076+ messages in thread
From: Tobias Klausmann @ 2018-03-31 14:17 UTC (permalink / raw
  To: gentoo-commits

commit:     b184d78b0ac6bc61ca3f3931dd849ce5b15d8963
Author:     Tobias Klausmann <klausman <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 31 14:17:11 2018 +0000
Commit:     Tobias Klausmann <klausman <AT> gentoo <DOT> org>
CommitDate: Sat Mar 31 14:17:27 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b184d78b

sys-libs/glibc-2.25-r11: alpha stable

Gentoo-Bug: http://bugs.gentoo.org/646492

 sys-libs/glibc/glibc-2.25-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index ffe2773d451..82b0f80a83f 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ~ppc ppc64 ~s390 ~sh sparc x86"
+KEYWORDS="alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ~ppc ppc64 ~s390 ~sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-04-01 21:47 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-04-01 21:47 UTC (permalink / raw
  To: gentoo-commits

commit:     68960fd5ca05ab49b211ebd1b33a4bb1b8e3a637
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  1 21:46:41 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Apr  1 21:46:41 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=68960fd5

sys-libs/glibc: stable 2.25-r11 for ppc, bug #646492

Package-Manager: Portage-2.3.27, Repoman-2.3.9
RepoMan-Options: --include-arches="ppc"

 sys-libs/glibc/glibc-2.25-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index 82b0f80a83f..45c7b459219 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ~ppc ppc64 ~s390 ~sh sparc x86"
+KEYWORDS="alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-04-03 20:21 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-04-03 20:21 UTC (permalink / raw
  To: gentoo-commits

commit:     ad34d5e17e56a4a446402185cd67d7b920edf28f
Author:     Palmer Dabbelt <palmer <AT> dabbelt <DOT> com>
AuthorDate: Tue Apr  3 20:10:41 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Apr  3 20:21:18 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ad34d5e1

sys-libs/glibc: Add support for building RISC-V headers

The RISC-V GCC port defines some extra preprocessor macros that glibc
uses to determine which RISC-V target is being compiled for.  Since
crossdev doesn't use a RISC-V compiler to build the headers, this blows
up.  These checks don't matter for building the headers because they're
the same on all RISC-V targets, so we just hack up the glibc build to
elide the check.

 sys-libs/glibc/glibc-2.27-r1.ebuild | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.27-r1.ebuild b/sys-libs/glibc/glibc-2.27-r1.ebuild
index b281c00fac3..588eebae7f2 100644
--- a/sys-libs/glibc/glibc-2.27-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r1.ebuild
@@ -762,6 +762,23 @@ src_prepare() {
 			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
 			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
 		fi
+		if [[ -e sysdeps/riscv/preconfigure ]] ; then
+			# RISC-V interrogates the compiler to determine which target to
+			# build.  If building the headers then we don't strictly need a
+			# RISC-V compiler, so the built-in definitions that are provided
+			# along with all RISC-V compiler might not exist.  This causes
+			# glibc's RISC-V preconfigure script to blow up.  Since we're just
+			# building the headers any value will actually work here, so just
+			# pick the standard one (rv64g/lp64d) to make the build scripts
+			# happy for now -- the headers are all the same anyway so it
+			# doesn't matter.
+			sed -i 's/^    xlen=.*/    xlen=64/g' sysdeps/riscv/preconfigure || die
+			sed -i 's/^    flen=.*/    flen=64/g' sysdeps/riscv/preconfigure || die
+			sed -i 's/^    float_abi=.*/    float_abi=double/g' sysdeps/riscv/preconfigure || die
+			sed -i 's/^    atomic=.*/    atomic=__riscv_atomic/g' sysdeps/riscv/preconfigure || die
+			sed -i 's/^libc_cv_riscv_float_abi=no/libc_cv_riscv_float_abi=d/g' sysdeps/unix/sysv/linux/riscv/configure.ac || die
+			sed -i 's/^libc_cv_riscv_float_abi=no/libc_cv_riscv_float_abi=d/g' sysdeps/unix/sysv/linux/riscv/configure || die
+		fi
 	fi
 
 	default


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-04-03 20:21 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-04-03 20:21 UTC (permalink / raw
  To: gentoo-commits

commit:     3aa32984919c421909d2796a89f6cefe402c3fd8
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Apr  3 20:20:45 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Apr  3 20:21:19 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3aa32984

sys-libs/glibc: apply riscv kludge to live ebuild

This pulls in commit from 2.27-r1
"sys-libs/glibc: Add support for building RISC-V headers"
Package-Manager: Portage-2.3.28, Repoman-2.3.9

 sys-libs/glibc/glibc-9999.ebuild | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 17f8cdafed5..e6d10969e8b 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -762,6 +762,23 @@ src_prepare() {
 			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
 			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
 		fi
+		if [[ -e sysdeps/riscv/preconfigure ]] ; then
+			# RISC-V interrogates the compiler to determine which target to
+			# build.  If building the headers then we don't strictly need a
+			# RISC-V compiler, so the built-in definitions that are provided
+			# along with all RISC-V compiler might not exist.  This causes
+			# glibc's RISC-V preconfigure script to blow up.  Since we're just
+			# building the headers any value will actually work here, so just
+			# pick the standard one (rv64g/lp64d) to make the build scripts
+			# happy for now -- the headers are all the same anyway so it
+			# doesn't matter.
+			sed -i 's/^    xlen=.*/    xlen=64/g' sysdeps/riscv/preconfigure || die
+			sed -i 's/^    flen=.*/    flen=64/g' sysdeps/riscv/preconfigure || die
+			sed -i 's/^    float_abi=.*/    float_abi=double/g' sysdeps/riscv/preconfigure || die
+			sed -i 's/^    atomic=.*/    atomic=__riscv_atomic/g' sysdeps/riscv/preconfigure || die
+			sed -i 's/^libc_cv_riscv_float_abi=no/libc_cv_riscv_float_abi=d/g' sysdeps/unix/sysv/linux/riscv/configure.ac || die
+			sed -i 's/^libc_cv_riscv_float_abi=no/libc_cv_riscv_float_abi=d/g' sysdeps/unix/sysv/linux/riscv/configure || die
+		fi
 	fi
 
 	default


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-04-06  6:43 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-04-06  6:43 UTC (permalink / raw
  To: gentoo-commits

commit:     a0969ccd7c373fa08f89e7bb59c6b7ee27f7751e
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  6 06:43:35 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Apr  6 06:43:49 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a0969ccd

sys-libs/glibc: drop outdated ports/sysdeps/mips/ mangling

ports/ is no more. All mips ports were merged into glibc repository.

Package-Manager: Portage-2.3.28, Repoman-2.3.9

 sys-libs/glibc/glibc-9999.ebuild | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index e6d10969e8b..12272c31f35 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -755,13 +755,6 @@ src_prepare() {
 	fi
 
 	if just_headers ; then
-		if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
-			# mips peeps like to screw with us.  if building headers,
-			# we don't have a real compiler, so we can't let them
-			# insert -mabi on us.
-			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
-			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
-		fi
 		if [[ -e sysdeps/riscv/preconfigure ]] ; then
 			# RISC-V interrogates the compiler to determine which target to
 			# build.  If building the headers then we don't strictly need a


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-04-06 19:13 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-04-06 19:13 UTC (permalink / raw
  To: gentoo-commits

commit:     dc0564d9e7675dad5603d5e8cfbf50e0154891b5
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  6 19:13:27 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Apr  6 19:13:38 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dc0564d9

sys-libs/glibc: tweak riscv preconfigure mangling

Changed 'preconfigure' mangling from using sed to using CPPFLAGS.
While at it move the hack closer to ./configure call.

Package-Manager: Portage-2.3.28, Repoman-2.3.9

 sys-libs/glibc/glibc-2.27-r1.ebuild | 43 ++++++++++++++++++------------------
 sys-libs/glibc/glibc-9999.ebuild    | 44 +++++++++++++++++++------------------
 2 files changed, 45 insertions(+), 42 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.27-r1.ebuild b/sys-libs/glibc/glibc-2.27-r1.ebuild
index c61cf3e2929..3cc1a137ada 100644
--- a/sys-libs/glibc/glibc-2.27-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r1.ebuild
@@ -754,26 +754,6 @@ src_prepare() {
 		einfo "Done."
 	fi
 
-	if just_headers ; then
-		if [[ -e sysdeps/riscv/preconfigure ]] ; then
-			# RISC-V interrogates the compiler to determine which target to
-			# build.  If building the headers then we don't strictly need a
-			# RISC-V compiler, so the built-in definitions that are provided
-			# along with all RISC-V compiler might not exist.  This causes
-			# glibc's RISC-V preconfigure script to blow up.  Since we're just
-			# building the headers any value will actually work here, so just
-			# pick the standard one (rv64g/lp64d) to make the build scripts
-			# happy for now -- the headers are all the same anyway so it
-			# doesn't matter.
-			sed -i 's/^    xlen=.*/    xlen=64/g' sysdeps/riscv/preconfigure || die
-			sed -i 's/^    flen=.*/    flen=64/g' sysdeps/riscv/preconfigure || die
-			sed -i 's/^    float_abi=.*/    float_abi=double/g' sysdeps/riscv/preconfigure || die
-			sed -i 's/^    atomic=.*/    atomic=__riscv_atomic/g' sysdeps/riscv/preconfigure || die
-			sed -i 's/^libc_cv_riscv_float_abi=no/libc_cv_riscv_float_abi=d/g' sysdeps/unix/sysv/linux/riscv/configure.ac || die
-			sed -i 's/^libc_cv_riscv_float_abi=no/libc_cv_riscv_float_abi=d/g' sysdeps/unix/sysv/linux/riscv/configure || die
-		fi
-	fi
-
 	default
 
 	gnuconfig_update
@@ -1009,6 +989,8 @@ glibc_headers_configure() {
 		export ${v}
 	done
 
+	local headers_only_arch_CPPFLAGS=()
+
 	# Blow away some random CC settings that screw things up. #550192
 	if [[ -d ${S}/sysdeps/mips ]]; then
 		pushd "${S}"/sysdeps/mips >/dev/null
@@ -1025,6 +1007,25 @@ glibc_headers_configure() {
 		popd >/dev/null
 	fi
 
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
 	local myconf=()
 	myconf+=(
 		--disable-sanity-checks
@@ -1043,7 +1044,7 @@ glibc_headers_configure() {
 	# So forcing CC/CFLAGS is sane.
 	local headers_only_CC=$(tc-getBUILD_CC)
 	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
 	local headers_only_LDFLAGS=""
 	set -- "${S}"/configure "${myconf[@]}"
 	echo \

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 12272c31f35..519bc28c954 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -754,26 +754,6 @@ src_prepare() {
 		einfo "Done."
 	fi
 
-	if just_headers ; then
-		if [[ -e sysdeps/riscv/preconfigure ]] ; then
-			# RISC-V interrogates the compiler to determine which target to
-			# build.  If building the headers then we don't strictly need a
-			# RISC-V compiler, so the built-in definitions that are provided
-			# along with all RISC-V compiler might not exist.  This causes
-			# glibc's RISC-V preconfigure script to blow up.  Since we're just
-			# building the headers any value will actually work here, so just
-			# pick the standard one (rv64g/lp64d) to make the build scripts
-			# happy for now -- the headers are all the same anyway so it
-			# doesn't matter.
-			sed -i 's/^    xlen=.*/    xlen=64/g' sysdeps/riscv/preconfigure || die
-			sed -i 's/^    flen=.*/    flen=64/g' sysdeps/riscv/preconfigure || die
-			sed -i 's/^    float_abi=.*/    float_abi=double/g' sysdeps/riscv/preconfigure || die
-			sed -i 's/^    atomic=.*/    atomic=__riscv_atomic/g' sysdeps/riscv/preconfigure || die
-			sed -i 's/^libc_cv_riscv_float_abi=no/libc_cv_riscv_float_abi=d/g' sysdeps/unix/sysv/linux/riscv/configure.ac || die
-			sed -i 's/^libc_cv_riscv_float_abi=no/libc_cv_riscv_float_abi=d/g' sysdeps/unix/sysv/linux/riscv/configure || die
-		fi
-	fi
-
 	default
 
 	gnuconfig_update
@@ -1009,6 +989,8 @@ glibc_headers_configure() {
 		export ${v}
 	done
 
+	local headers_only_arch_CPPFLAGS=()
+
 	# Blow away some random CC settings that screw things up. #550192
 	if [[ -d ${S}/sysdeps/mips ]]; then
 		pushd "${S}"/sysdeps/mips >/dev/null
@@ -1025,6 +1007,25 @@ glibc_headers_configure() {
 		popd >/dev/null
 	fi
 
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
 	local myconf=()
 	myconf+=(
 		--disable-sanity-checks
@@ -1043,7 +1044,7 @@ glibc_headers_configure() {
 	# So forcing CC/CFLAGS is sane.
 	local headers_only_CC=$(tc-getBUILD_CC)
 	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
 	local headers_only_LDFLAGS=""
 	set -- "${S}"/configure "${myconf[@]}"
 	echo \
@@ -1101,6 +1102,7 @@ src_test() {
 	if just_headers ; then
 		return
 	fi
+
 	# Give tests more time to complete.
 	export TIMEOUTFACTOR=5
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-04-06 19:13 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-04-06 19:13 UTC (permalink / raw
  To: gentoo-commits

commit:     1f8d3e8790c218aaadaa942cd8c8bbe072e593ab
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  6 07:05:33 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Apr  6 19:13:37 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1f8d3e87

sys-libs/glibc: drop outdated ports/sysdeps/mips/ mangling

ports/ is no more. All mips ports were merged into glibc repository.

Package-Manager: Portage-2.3.28, Repoman-2.3.9

 sys-libs/glibc/glibc-2.27-r1.ebuild | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.27-r1.ebuild b/sys-libs/glibc/glibc-2.27-r1.ebuild
index 588eebae7f2..c61cf3e2929 100644
--- a/sys-libs/glibc/glibc-2.27-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r1.ebuild
@@ -755,13 +755,6 @@ src_prepare() {
 	fi
 
 	if just_headers ; then
-		if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
-			# mips peeps like to screw with us.  if building headers,
-			# we don't have a real compiler, so we can't let them
-			# insert -mabi on us.
-			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
-			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
-		fi
 		if [[ -e sysdeps/riscv/preconfigure ]] ; then
 			# RISC-V interrogates the compiler to determine which target to
 			# build.  If building the headers then we don't strictly need a


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-04-08 10:55 Markus Meier
  0 siblings, 0 replies; 1076+ messages in thread
From: Markus Meier @ 2018-04-08 10:55 UTC (permalink / raw
  To: gentoo-commits

commit:     97f5416318ff31f6d99c84fe5b6fe4d32a844bcb
Author:     Markus Meier <maekke <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  8 10:50:54 2018 +0000
Commit:     Markus Meier <maekke <AT> gentoo <DOT> org>
CommitDate: Sun Apr  8 10:50:54 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=97f54163

sys-libs/glibc: arm stable, bug #646492

Package-Manager: Portage-2.3.24, Repoman-2.3.6
RepoMan-Options: --include-arches="arm"

 sys-libs/glibc/glibc-2.25-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index 45c7b459219..4595e6f1306 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
+KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-04-09  6:23 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-04-09  6:23 UTC (permalink / raw
  To: gentoo-commits

commit:     c7684eaa754323674d11a2a6e6e46e5d1e079a45
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  9 06:23:09 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon Apr  9 06:23:25 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c7684eaa

sys-libs/glibc: fix USE=headers-only install for powerpc64le target

glibc-2.27 needs 2 more sanity checks from native compiler to pass configure:
  libc_cv_compiler_powerpc64le_binary128_ok=yes
  libc_cv_target_power8_ok=yes

Notices when tried clean toolchain botstrap for bug #652724

Bug: https://bugs.gentoo.org/652724
Package-Manager: Portage-2.3.28, Repoman-2.3.9

 sys-libs/glibc/glibc-2.27-r1.ebuild | 2 ++
 sys-libs/glibc/glibc-9999.ebuild    | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.27-r1.ebuild b/sys-libs/glibc/glibc-2.27-r1.ebuild
index 3cc1a137ada..523de8fcfa8 100644
--- a/sys-libs/glibc/glibc-2.27-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r1.ebuild
@@ -962,6 +962,7 @@ glibc_headers_configure() {
 		libc_cv_asm_cfi_directives=yes
 		libc_cv_broken_visibility_attribute=no
 		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
 		libc_cv_forced_unwind=yes
 		libc_cv_gcc___thread=yes
 		libc_cv_mlong_double_128=yes
@@ -969,6 +970,7 @@ glibc_headers_configure() {
 		libc_cv_ppc_machine=yes
 		libc_cv_ppc_rel16=yes
 		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
 		libc_cv_visibility_attribute=yes
 		libc_cv_z_combreloc=yes
 		libc_cv_z_execstack=yes

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 519bc28c954..24e9f43bde8 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -962,6 +962,7 @@ glibc_headers_configure() {
 		libc_cv_asm_cfi_directives=yes
 		libc_cv_broken_visibility_attribute=no
 		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
 		libc_cv_forced_unwind=yes
 		libc_cv_gcc___thread=yes
 		libc_cv_mlong_double_128=yes
@@ -969,6 +970,7 @@ glibc_headers_configure() {
 		libc_cv_ppc_machine=yes
 		libc_cv_ppc_rel16=yes
 		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
 		libc_cv_visibility_attribute=yes
 		libc_cv_z_combreloc=yes
 		libc_cv_z_execstack=yes


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-04-09 22:38 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-04-09 22:38 UTC (permalink / raw
  To: gentoo-commits

commit:     9e49c5ca961aa85703fbe41c84e108d212fd2a2b
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  9 22:36:03 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon Apr  9 22:37:58 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9e49c5ca

sys-libs/glibc: fix strip path for cross-compiler's glibc

Noticed as warnings on non-existing path when installing
    =cross-powerpc64le-foo-linux-gnu/glibc-2.27-r1

Package-Manager: Portage-2.3.28, Repoman-2.3.9

 sys-libs/glibc/glibc-2.27-r1.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.27-r1.ebuild b/sys-libs/glibc/glibc-2.27-r1.ebuild
index 523de8fcfa8..017249c804f 100644
--- a/sys-libs/glibc/glibc-2.27-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r1.ebuild
@@ -1324,7 +1324,7 @@ src_strip() {
 	# if user has stripping enabled and does not have split debug turned on,
 	# then leave the debugging sections in libpthread.
 	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"/*/libpthread-*.so
+		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
 	fi
 }
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 24e9f43bde8..100724cc841 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1324,7 +1324,7 @@ src_strip() {
 	# if user has stripping enabled and does not have split debug turned on,
 	# then leave the debugging sections in libpthread.
 	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"/*/libpthread-*.so
+		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
 	fi
 }
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-04-13 20:08 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-04-13 20:08 UTC (permalink / raw
  To: gentoo-commits

commit:     d75dc07b2077a4d73f731b8cf5290a326bb5ecce
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Fri Apr 13 19:56:05 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Apr 13 20:07:37 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d75dc07b

sys-libs/glibc: stable 2.25-r11 for hppa

Bug: https://bugs.gentoo.org/646492
Package-Manager: Portage-2.3.24, Repoman-2.3.6
RepoMan-Options: --include-arches="hppa"

 sys-libs/glibc/glibc-2.25-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index 4595e6f1306..6e74ceffe23 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-04-13 23:22 Aaron Bauman
  0 siblings, 0 replies; 1076+ messages in thread
From: Aaron Bauman @ 2018-04-13 23:22 UTC (permalink / raw
  To: gentoo-commits

commit:     4b00171b275c1ccfb51a65aca16cd0a59ebbe259
Author:     Marty E. Plummer <hanetzer <AT> startmail <DOT> com>
AuthorDate: Tue Apr 10 23:52:22 2018 +0000
Commit:     Aaron Bauman <bman <AT> gentoo <DOT> org>
CommitDate: Fri Apr 13 23:21:20 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4b00171b

sys-libs/glibc: remove trailing whitespace

Package-Manager: Portage-2.3.28, Repoman-2.3.9

 sys-libs/glibc/glibc-2.19-r2.ebuild | 4 ++--
 sys-libs/glibc/glibc-2.27-r1.ebuild | 4 ++--
 sys-libs/glibc/glibc-9999.ebuild    | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index e4a5ff90de6..1b071fb4d3d 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -116,8 +116,8 @@ alt_prefix() {
 	is_crosscompile && echo /usr/${CTARGET}
 }
 
-# We need to be able to set alternative headers for compiling for non-native 
-# platform. Will also become useful for testing kernel-headers without screwing 
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
 # up the whole system.
 alt_headers() {
 	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}

diff --git a/sys-libs/glibc/glibc-2.27-r1.ebuild b/sys-libs/glibc/glibc-2.27-r1.ebuild
index 017249c804f..fe60c1f83c3 100644
--- a/sys-libs/glibc/glibc-2.27-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r1.ebuild
@@ -116,8 +116,8 @@ alt_prefix() {
 	is_crosscompile && echo /usr/${CTARGET}
 }
 
-# We need to be able to set alternative headers for compiling for non-native 
-# platform. Will also become useful for testing kernel-headers without screwing 
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
 # up the whole system.
 alt_headers() {
 	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 100724cc841..2e5552b3dcc 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -116,8 +116,8 @@ alt_prefix() {
 	is_crosscompile && echo /usr/${CTARGET}
 }
 
-# We need to be able to set alternative headers for compiling for non-native 
-# platform. Will also become useful for testing kernel-headers without screwing 
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
 # up the whole system.
 alt_headers() {
 	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-04-21  9:52 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2018-04-21  9:52 UTC (permalink / raw
  To: gentoo-commits

commit:     16cd30798425c2cfe8b03409186eaf25f35398e7
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 21 09:51:58 2018 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Sat Apr 21 09:52:26 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=16cd3079

sys-libs/glibc: m68k/s390/sh stable wrt bug #647062

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 sys-libs/glibc/glibc-2.25-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.25-r10.ebuild b/sys-libs/glibc/glibc-2.25-r10.ebuild
index 9517aa47225..0a26791252c 100644
--- a/sys-libs/glibc/glibc-2.25-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r10.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-04-21 21:25 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-04-21 21:25 UTC (permalink / raw
  To: gentoo-commits

commit:     3c4ea812e61978466afdbf77e44e04f808762e07
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 21 21:24:59 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Apr 21 21:25:19 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3c4ea812

sys-libs/glibc: Remove useflag debug and related logic. Bug 601718.

Closes: https://bugs.gentoo.org/601718
Package-Manager: Portage-2.3.27, Repoman-2.3.9

 sys-libs/glibc/glibc-9999.ebuild | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2e5552b3dcc..ca23762e8d4 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -33,7 +33,7 @@ PATCH_VER=5
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
 
-IUSE="audit caps compile-locales debug doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla"
+IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -775,14 +775,6 @@ src_prepare() {
 		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
 		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
 		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
 	fi
 }
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-04-21 21:51 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-04-21 21:51 UTC (permalink / raw
  To: gentoo-commits

commit:     3cade249e8a1cac4f504c73aada2d40f5722645d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 21 21:33:26 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Apr 21 21:51:15 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3cade249

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.27, Repoman-2.3.9

 sys-libs/glibc/Manifest             |   2 -
 sys-libs/glibc/glibc-2.25-r9.ebuild | 153 -------
 sys-libs/glibc/glibc-2.26-r5.ebuild | 836 ------------------------------------
 3 files changed, 991 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index b5b019b4872..b55476e954c 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,11 +14,9 @@ DIST glibc-2.23-patches-8.tar.bz2 304199 BLAKE2B 693e40090dbe43f0e9c1faa0bce75e4
 DIST glibc-2.23.tar.xz 13455260 BLAKE2B 6658e9d2d07c5cd71be94ef399bfe4d18ef462e4154e2e02aa69c34198e881cc65ac8f89abcb37b3d01c56b10e2f47c036492c20e4991a54bd03e56db703fbd2 SHA512 b82953388cd028e174cb08f082557bbce0dad8b67b17d31b29f90102fd52a51e03d591448ecb64882a1c1d5303afffc7f6ede85cee4c784a9284fbc9b4ad26cf
 DIST glibc-2.24-patches-10.tar.bz2 73586 BLAKE2B f42cc78b907e7cb5c8ba1672c845cdc0959f4d29f89ff642bd2efa795d7ac69409b514338ac1f4235ce2fbc0c9c9bb2d152f55fd14c02997517dc048a306e1c1 SHA512 fc9191a85da53a2515bbaab228648936682e04267284049468e0c82284f618ab2907b9247baca701e16edc50640199ff6d8e2a6a93ccbd5a9d3b0eb73cc484ca
 DIST glibc-2.24.tar.xz 13554048 BLAKE2B 9f93ac00f68eb88e3a2272752624163fac25dd064170e336143aa697908fba2b27ed926582f978da99c6c2489c0ce34d3eb266b5d00be69d27b36126bc2c8efb SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb
-DIST glibc-2.25-patches-12.tar.bz2 65396 BLAKE2B b23d5d681314c03b8dd5ad20516324c1ce5b24deb4d9ce03970dce97b524ee9d3f5d5463f2d6b7693e4c9ef25d006847f960993f55ca082fc961268d05f937ca SHA512 6af8c304ba70b42dfda294873d9a138d6c98e7a46496e305b2cac99a085d1ad3d00315162d1e1458e651de95e158bd35be74406a3f44fde13182e30baa663fcb
 DIST glibc-2.25-patches-13.tar.bz2 71481 BLAKE2B bf5691afabf03b579b8d634da30a2a967ab62d5e470a23b0946ff3354aa974b3b65821aca2f33dd30dd864a82459f4750178bf6ae01a5117ccfde62efd8f594e SHA512 7c80e4aba9edf0310e1707b03a6945f657d71267a4d0d67c24b979c841544a6a623d7c2dbb0a0d55863e25831439d717d096ecf377f936b731baeb04f21704a7
 DIST glibc-2.25-patches-15.tar.bz2 78320 BLAKE2B 70c62cc10db13e2844de4d8a18972e0f4d01ba52fbd40db57c11d7b1c2c0d571b894f01e762bb26632fd696a77c299ef0766e2f129d2eda896f58325a754a13c SHA512 7204218ea82b677e0f278c4752ddb90aa0c08ac2349d061de81ec91dac204b0f10fe223d7b1055b9e0c21dac97c835f913a90c0168a5000d3be00dd20027c185
 DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
-DIST glibc-2.26-patches-5.tar.bz2 357699 BLAKE2B 98a0cb231bf35a132747f1fa6e654a9ad2eff8b445f002a0239c9a45f5a896ad490570aedee2b43e6cfa94794ae5c8b5e312e369838c3770823f28b61b51b592 SHA512 0040469e4a85f5c2aac972e42aeb06b0adfc3a132b32b19306be9f1877339fe6651a2fbd4d90d502b07ae4460f74efbd1cd103d38a2038df9402b0a380f03c2a
 DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b217391156f897a8db50f65a69627d8f8cceded78414168986ee98eba038364a6b2f3599b23f95e7b0ad2643481c399718 SHA512 0c812a343fcc68c10d92117cb2a0cf1c255470e81f0a7a04d6db2fe35445e410ef37f15162f145c2eb772b08ab55af246f5b52f5e57c2e91038181f6f027abc3
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
 DIST glibc-2.27-patches-1.tar.bz2 15950 BLAKE2B ef2d2ede447b98c5e20f1bf1328f1379fd781b603a888f0fd7f1dbb6172e42222c9198d61dd75d9aafbed5c395a277a3c0d00ef4b70932fafb500b111e013963 SHA512 9e3ed7e271313c104eefcd383e6259c235b4e2f7a41be2ba8a1bfb469f8f54835ffde63ae89fa40af47b444911addb0db002a05d033bcc2832710b51650c91e3

diff --git a/sys-libs/glibc/glibc-2.25-r9.ebuild b/sys-libs/glibc/glibc-2.25-r9.ebuild
deleted file mode 100644
index 4e27a250e20..00000000000
--- a/sys-libs/glibc/glibc-2.25-r9.ebuild
+++ /dev/null
@@ -1,153 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit toolchain-glibc
-
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
-RESTRICT="strip" # strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-RELEASE_VER=""
-case ${PV} in
-9999*)
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
-	;;
-*)
-	RELEASE_VER=${PV}
-	;;
-esac
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="12"                                  # Gentoo patchset
-: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
-
-GLIBC_PATCH_EXCLUDE+=" 0005_all_sys-types.h-drop-sys-sysmacros.h-include.patch"
-
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla headers-only"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2"
-RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	!sys-libs/nss-db"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.7
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.7
-		virtual/os-headers"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~dilfridge/distfiles/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
-}
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
-
-src_unpack() {
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	toolchain-glibc_src_unpack
-}
-
-src_prepare() {
-	toolchain-glibc_src_prepare
-
-	cd "${S}"
-
-	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-	fi
-
-	case $(gcc-fullversion) in
-	4.8.[0-3]|4.9.0)
-		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
-		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
-		die "need to switch compilers #547420"
-		;;
-	esac
-}

diff --git a/sys-libs/glibc/glibc-2.26-r5.ebuild b/sys-libs/glibc/glibc-2.26-r5.ebuild
deleted file mode 100644
index 798f8ad6305..00000000000
--- a/sys-libs/glibc/glibc-2.26-r5.ebuild
+++ /dev/null
@@ -1,836 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix toolchain-glibc
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-
-# Gentoo patchset
-PATCH_VER=5
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
-
-IUSE="audit caps debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
-
-# Min kernel version glibc requires
-: ${NPTL_KERN_VER:="3.2.0"}
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	doc? ( sys-apps/texinfo )
-"
-RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.9
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.9
-		virtual/os-headers
-	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# the phases
-#
-
-pkg_pretend() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-		# The high rev # is to allow people to downgrade between -r# versions.
-		# We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine.
-		# Hopefully we never actually use a r# this high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction"
-			die "Aborting to save your system"
-		fi
-
-		if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
-		then
-			eerror "Your patched vendor kernel is broken.  You need to get an"
-			eerror "update from whoever is providing the kernel to you."
-			eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227"
-			eerror "https://bugs.gentoo.org/262698"
-			die "Keeping your system alive, say thank you"
-		fi
-
-		if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
-		then
-			eerror "Your old kernel is broken.  You need to update it to"
-			eerror "a newer version as syscall(<bignum>) will break."
-			eerror "https://bugs.gentoo.org/279260"
-			die "Keeping your system alive, say thank you"
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	use hardened && ! tc-enables-pie && \
-		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
-
-	# Make sure host system is up to date #394453
-	if has_version '<sys-libs/glibc-2.13' && \
-	   [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]]
-	then
-		ebegin "Scanning system for __guard to see if you need to rebuild first ..."
-		local files=$(
-			scanelf -qys__guard -F'#s%F' \
-				"${EROOT}"/*bin/ \
-				"${EROOT}"/lib* \
-				"${EROOT}"/usr/*bin/ \
-				"${EROOT}"/usr/lib* | \
-				egrep -v \
-					-e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \
-					-e "^${EROOT}/sbin/(ldconfig|sln)$"
-		)
-		[[ -z ${files} ]]
-		if ! eend $? ; then
-			eerror "Your system still has old SSP __guard symbols.  You need to"
-			eerror "rebuild all the packages that provide these files first:"
-			eerror "${files}"
-			die "old __guard detected"
-		fi
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-}
-
-src_unpack() {
-	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	setup_env
-
-	# Check NPTL support _before_ we unpack things to save some time
-	check_nptl_support
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}"
-	touch locale/C-translit.h #185476 #218003
-
-	cd "${WORKDIR}"
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	if just_headers ; then
-		if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
-			# mips peeps like to screw with us.  if building headers,
-			# we don't have a real compiler, so we can't let them
-			# insert -mabi on us.
-			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
-			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
-		fi
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-	fi
-}
-
-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 $1"
-
-	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 ; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-
-	# The glibc configure script doesn't properly use LDFLAGS all the time.
-	export CC="$(tc-getCC ${CTARGET}) ${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)"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	# set addons
-	pushd "${S}" > /dev/null
-	local addons=$(echo */configure | sed \
-		-e 's:/configure::g' \
-		-e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
-		-e 's: \+$::' \
-		-e 's! !,!g' \
-		-e 's!^!,!' \
-		-e '/^,\*$/d')
-	[[ -d ports ]] && addons+=",ports"
-	popd > /dev/null
-
-	case ${CTARGET} in
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=all )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	if [[ $1 == "nptl" ]] ; then
-		myconf+=( --enable-kernel=${NPTL_KERN_VER} )
-	else
-		die "invalid pthread option"
-	fi
-	myconf+=( --enable-add-ons="${addons#,}" )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(in_iuse systemtap && use_enable systemtap)
-		$(in_iuse nscd && use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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 "$1")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	local addons
-	[[ -d ${S}/ports ]] && addons+=",ports"
-	myconf+=( --enable-add-ons="${addons#,}" )
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	CC="$(tc-getBUILD_CC)" \
-	CFLAGS="-O1 -pipe" \
-	CPPFLAGS="-U_FORTIFY_SOURCE" \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir $1)"
-	emake -j1 check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test nptl
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if in_iuse suid && ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		cd "${ED}"$(alt_libdir)/..
-		[[ -e lib ]] || mkdir lib
-		cd "${ED}"$(alt_usrlibdir)/..
-		[[ -e lib ]] || mkdir lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		# if the host locales.gen contains no entries, we'll install everything
-		local locale_list="${EROOT}etc/locale.gen"
-		if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-			ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-			locale_list="${EROOT}usr/share/i18n/SUPPORTED"
-		fi
-		locale-gen -j $(makeopts_jobs) --config "${locale_list}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-04-28 21:23 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-04-28 21:23 UTC (permalink / raw
  To: gentoo-commits

commit:     be27313d300d7e9ccc87654551edc7398a474f1b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 28 21:23:20 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Apr 28 21:23:48 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=be27313d

sys-libs/glibc: Drop vulnerable version, bug 646492

This removes last stable on m68k, sh, s390 (we're way
beyond any timeout there).

Bug: https://bugs.gentoo.org/646492
Package-Manager: Portage-2.3.31, Repoman-2.3.9

 sys-libs/glibc/Manifest              |   1 -
 sys-libs/glibc/glibc-2.25-r10.ebuild | 153 -----------------------------------
 2 files changed, 154 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index b55476e954c..71fdce7bee9 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,7 +14,6 @@ DIST glibc-2.23-patches-8.tar.bz2 304199 BLAKE2B 693e40090dbe43f0e9c1faa0bce75e4
 DIST glibc-2.23.tar.xz 13455260 BLAKE2B 6658e9d2d07c5cd71be94ef399bfe4d18ef462e4154e2e02aa69c34198e881cc65ac8f89abcb37b3d01c56b10e2f47c036492c20e4991a54bd03e56db703fbd2 SHA512 b82953388cd028e174cb08f082557bbce0dad8b67b17d31b29f90102fd52a51e03d591448ecb64882a1c1d5303afffc7f6ede85cee4c784a9284fbc9b4ad26cf
 DIST glibc-2.24-patches-10.tar.bz2 73586 BLAKE2B f42cc78b907e7cb5c8ba1672c845cdc0959f4d29f89ff642bd2efa795d7ac69409b514338ac1f4235ce2fbc0c9c9bb2d152f55fd14c02997517dc048a306e1c1 SHA512 fc9191a85da53a2515bbaab228648936682e04267284049468e0c82284f618ab2907b9247baca701e16edc50640199ff6d8e2a6a93ccbd5a9d3b0eb73cc484ca
 DIST glibc-2.24.tar.xz 13554048 BLAKE2B 9f93ac00f68eb88e3a2272752624163fac25dd064170e336143aa697908fba2b27ed926582f978da99c6c2489c0ce34d3eb266b5d00be69d27b36126bc2c8efb SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb
-DIST glibc-2.25-patches-13.tar.bz2 71481 BLAKE2B bf5691afabf03b579b8d634da30a2a967ab62d5e470a23b0946ff3354aa974b3b65821aca2f33dd30dd864a82459f4750178bf6ae01a5117ccfde62efd8f594e SHA512 7c80e4aba9edf0310e1707b03a6945f657d71267a4d0d67c24b979c841544a6a623d7c2dbb0a0d55863e25831439d717d096ecf377f936b731baeb04f21704a7
 DIST glibc-2.25-patches-15.tar.bz2 78320 BLAKE2B 70c62cc10db13e2844de4d8a18972e0f4d01ba52fbd40db57c11d7b1c2c0d571b894f01e762bb26632fd696a77c299ef0766e2f129d2eda896f58325a754a13c SHA512 7204218ea82b677e0f278c4752ddb90aa0c08ac2349d061de81ec91dac204b0f10fe223d7b1055b9e0c21dac97c835f913a90c0168a5000d3be00dd20027c185
 DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
 DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b217391156f897a8db50f65a69627d8f8cceded78414168986ee98eba038364a6b2f3599b23f95e7b0ad2643481c399718 SHA512 0c812a343fcc68c10d92117cb2a0cf1c255470e81f0a7a04d6db2fe35445e410ef37f15162f145c2eb772b08ab55af246f5b52f5e57c2e91038181f6f027abc3

diff --git a/sys-libs/glibc/glibc-2.25-r10.ebuild b/sys-libs/glibc/glibc-2.25-r10.ebuild
deleted file mode 100644
index 0a26791252c..00000000000
--- a/sys-libs/glibc/glibc-2.25-r10.ebuild
+++ /dev/null
@@ -1,153 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit toolchain-glibc
-
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
-RESTRICT="strip" # strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-RELEASE_VER=""
-case ${PV} in
-9999*)
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
-	;;
-*)
-	RELEASE_VER=${PV}
-	;;
-esac
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="13"                                  # Gentoo patchset
-: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
-
-GLIBC_PATCH_EXCLUDE+=" 0005_all_sys-types.h-drop-sys-sysmacros.h-include.patch"
-
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla headers-only"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2"
-RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	!sys-libs/nss-db"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.7
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.7
-		virtual/os-headers"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~dilfridge/distfiles/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
-}
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
-
-src_unpack() {
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	toolchain-glibc_src_unpack
-}
-
-src_prepare() {
-	toolchain-glibc_src_prepare
-
-	cd "${S}"
-
-	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-	fi
-
-	case $(gcc-fullversion) in
-	4.8.[0-3]|4.9.0)
-		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
-		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
-		die "need to switch compilers #547420"
-		;;
-	esac
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-05-01 20:19 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-05-01 20:19 UTC (permalink / raw
  To: gentoo-commits

commit:     589ce025faee90c57c76c0da6f8534f707132d8f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue May  1 20:18:52 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue May  1 20:19:17 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=589ce025

sys-libs/glibc: Add new bootstrap files from stages, bug 647070

See https://github.com/gentoo/gcc-multilib-bootstrap/ for the source.
This is as good as we can do at the moment. Tested by building an
x32 glibc on a normal amd64 system.

For the glibc-2.26 stabilization we still need new files for PowerPC.

Current status:
* amd64, x32, x86: Files from gcc-6.4
* s390, s390x: Files from gcc-5.4 (does this work?)
* ppc, ppc64: no files, since only gcc-4.9 available
* n32, n64, o32: no files, last mips stages are years old, not useful

Bug: https://bugs.gentoo.org/647070
Package-Manager: Portage-2.3.31, Repoman-2.3.9

 sys-libs/glibc/Manifest                            |   1 +
 .../{glibc-9999.ebuild => glibc-2.26-r7.ebuild}    | 829 ++++-----------------
 .../{glibc-9999.ebuild => glibc-2.27-r2.ebuild}    |  20 +-
 sys-libs/glibc/glibc-9999.ebuild                   |   8 +-
 4 files changed, 148 insertions(+), 710 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 71fdce7bee9..767c577845d 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -1,4 +1,5 @@
 DIST gcc-4.7.3-r1-multilib-bootstrap.tar.bz2 8064097 BLAKE2B 3cc5c82cd57d0fbd26d9a376ee8ca02f119fe9d653311cbe4d2b7b93aec2290adac3be271be19a7fdedae2e11e4b6e32360184e557204e100ad64357f5575d4b SHA512 40b93e194ad41a75d649d84d1c49070680f253a13f0617803243bc61c44fed1ca2d0a7572a97ebb79353f312b58b5f6360be916dd7435928cc53935082e15269
+DIST gcc-multilib-bootstrap-20180501.tar.xz 2128700 BLAKE2B edeb5447bf397dfeee1295beb10b0e34253da8b3e1816720b6cfc3300a1c685fa022c3b809402a86340bbd7b9488d22cfba4c042d530dcb05ec971a2b1580d34 SHA512 eb289c44c5dcabaa727612dd685801b61e1fbe94b39024ecb3e14c73f9eaff68e05949a8f277a86c7471955cc8ec6e0127623b9861be7ac85f63226618b6c9c2
 DIST glibc-2.18-patches-4.tar.bz2 95165 BLAKE2B 70280e0f5fd0b1ee13cd0464aafaa9c9324528d0bee8024e6529d67d908991012066db6d8257b66983a1f52e32b3aad7718612fdab9ea199fef845db93347168 SHA512 d881c9c5fe32b967694d4ca5185ff5ffc964449f2ed49fd062e5d57a3c6d9f16eef2f591d2d8e98a1a95a6487f3436ef031839ed8766fd085404b288340b7933
 DIST glibc-2.18.tar.xz 11150148 BLAKE2B 7848a5a50abedbd17085e05b6f6835959adb5e55a424d95fa8a49eeec999a6dd81a9382db85ef7e852ef1d7743c5d312dccbf42024e95edf0e802eb32928dfe5 SHA512 27218d2e7dd3bf3908d7af171c490933680e958c579ebd27b43b661e223fd5de2219cc1cf699170405280808c84de476d0ad86dbba35a488ef404e9438552327
 DIST glibc-2.19-patches-3.tar.bz2 80664 BLAKE2B fb348c711941c1bd4dadd905e172dc4f239d8b63af1a1d14dcf4ec45c504bd47e10e9b24b38f9e01796016f2e97caeeb693213ae08147274ed0a4d9501293be0 SHA512 d281d6a2757920124cf8a3f02b97e75192598b08d96ae48840df34c7ffdcb212952d171f233e6f12a429b19437d0a296212fe1f2eae164d6a1c6793cb3cb69f0

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
similarity index 50%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.26-r7.ebuild
index ca23762e8d4..dad9a620a2c 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -3,40 +3,40 @@
 
 EAPI=6
 
-inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
+inherit prefix toolchain-glibc
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
+
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
 RESTRICT="strip" # Strip ourself #46186
-SLOT="2.2"
-
 EMULTILIB_PKG="true"
 
+# Configuration variables
+
 if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	KEYWORDS=""
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 
 RELEASE_VER=${PV}
 
-GCC_BOOTSTRAP_VER="4.7.3-r1"
+GCC_BOOTSTRAP_VER=20180501
 
 # Gentoo patchset
-PATCH_VER=5
+PATCH_VER=7
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla"
+IUSE="audit caps debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
 
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
+# Min kernel version glibc requires
+: ${NPTL_KERN_VER:="3.2.0"}
 
 # Here's how the cross-compile logic breaks down ...
 #  CTARGET - machine that will target the binaries
@@ -51,7 +51,7 @@ MIN_KERN_VER="3.2.0"
 # For install paths:
 #  CHOST = CTARGET  - install into /
 #  CHOST != CTARGET - install into /usr/CTARGET/
-#
+
 export CBUILD=${CBUILD:-${CHOST}}
 export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
@@ -60,8 +60,14 @@ if [[ ${CTARGET} == ${CHOST} ]] ; then
 	fi
 fi
 
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS.
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
 COMMON_DEPEND="
 	nscd? ( selinux? (
 		audit? ( sys-process/audit )
@@ -75,12 +81,11 @@ DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
 	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
 	doc? ( sys-apps/texinfo )
 "
 RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
 	!sys-kernel/ps3-sources
+	sys-apps/gentoo-functions
 	!sys-libs/nss-db
 "
 
@@ -101,495 +106,10 @@ else
 fi
 
 #
-# Small helper functions
+# the phases
 #
 
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparc64v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparcv9v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	filter-flags '-fstack-protector*'
-
-	# Starting with gcc-6 (and fully upstreamed pie patches) we control
-	# default enabled/disabled pie via use flags. So nothing to do
-	# here then. #618160
-	if [[ $(gcc-major-version) -lt 6 ]]; then
-		if use hardened && tc-enables-pie ; then
-			# Force PIC macro definition for all compilations since they're all
-			# either -fPIC or -fPIE with the default-PIE compiler.
-			append-cppflags -DPIC
-		else
-			# Don't build -fPIE without the default-PIE compiler and the
-			# hardened-pie patch
-			filter-flags -fPIE
-		fi
-	fi
-}
-
-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}
-}
-
-use_multiarch() {
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	version_is_at_least ${nver} ${bver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if use headers-only ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
+pkg_pretend() {
 	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
 	check_devpts
 
@@ -598,21 +118,30 @@ sanity_prechecks() {
 	   [[ ${ROOT} == "/" ]] && \
 	   [[ ${CBUILD} == ${CHOST} ]] && \
 	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
+		# The high rev # is to allow people to downgrade between -r# versions.
+		# We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine.
+		# Hopefully we never actually use a r# this high.
 		if has_version ">${CATEGORY}/${P}-r10000" ; then
 			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
+			eerror " Downgrading glibc is not supported and a sure way to destruction"
+			die "Aborting to save your system"
+		fi
+
+		if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
+		then
+			eerror "Your patched vendor kernel is broken.  You need to get an"
+			eerror "update from whoever is providing the kernel to you."
+			eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227"
+			eerror "https://bugs.gentoo.org/262698"
+			die "Keeping your system alive, say thank you"
 		fi
 
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
+		if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
+		then
+			eerror "Your old kernel is broken.  You need to update it to"
+			eerror "a newer version as syscall(<bignum>) will break."
+			eerror "https://bugs.gentoo.org/279260"
+			die "Keeping your system alive, say thank you"
 		fi
 	fi
 
@@ -639,6 +168,30 @@ sanity_prechecks() {
 	use hardened && ! tc-enables-pie && \
 		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
 
+	# Make sure host system is up to date #394453
+	if has_version '<sys-libs/glibc-2.13' && \
+	   [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]]
+	then
+		ebegin "Scanning system for __guard to see if you need to rebuild first ..."
+		local files=$(
+			scanelf -qys__guard -F'#s%F' \
+				"${EROOT}"/*bin/ \
+				"${EROOT}"/lib* \
+				"${EROOT}"/usr/*bin/ \
+				"${EROOT}"/usr/lib* | \
+				egrep -v \
+					-e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \
+					-e "^${EROOT}/sbin/(ldconfig|sln)$"
+		)
+		[[ -z ${files} ]]
+		if ! eend $? ; then
+			eerror "Your system still has old SSP __guard symbols.  You need to"
+			eerror "rebuild all the packages that provide these files first:"
+			eerror "${files}"
+			die "old __guard detected"
+		fi
+	fi
+
 	# Check for sanity of /etc/nsswitch.conf
 	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
 		local entry
@@ -653,97 +206,26 @@ sanity_prechecks() {
 			fi
 		done
 	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers ; then
-		local run_kv build_kv want_kv
-
-		run_kv=$(g_get_running_KV)
-		build_kv=$(g_int_to_KV $(get_kheader_version))
-		want_kv=${MIN_KERN_VER}
-
-		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!"
-		fi
-
-		if ! is_crosscompile && ! tc-is-cross-compiler ; then
-			# Building fails on an non-supporting kernel
-			ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-			if ! eend_KV ${run_kv} ${want_kv} ; then
-				echo
-				eerror "You need a kernel of at least ${want_kv}!"
-				die "Kernel version too low!"
-			fi
-		fi
-
-		ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-		if ! eend_KV ${build_kv} ${want_kv} ; then
-			echo
-			eerror "You need linux-headers of at least ${want_kv}!"
-			die "linux-headers version too low!"
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
 }
 
-# src_unpack
-
 src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
 
 	setup_env
 
+	# Check NPTL support _before_ we unpack things to save some time
+	check_nptl_support
+
 	if [[ -n ${EGIT_REPO_URI} ]] ; then
 		git-r3_src_unpack
 	else
 		unpack ${P}.tar.xz
 	fi
 
-	cd "${S}" || die
-	touch locale/C-translit.h || die #185476 #218003
+	cd "${S}"
+	touch locale/C-translit.h #185476 #218003
 
-	cd "${WORKDIR}" || die
+	cd "${WORKDIR}"
 	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
 }
 
@@ -754,6 +236,16 @@ src_prepare() {
 		einfo "Done."
 	fi
 
+	if just_headers ; then
+		if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
+			# mips peeps like to screw with us.  if building headers,
+			# we don't have a real compiler, so we can't let them
+			# insert -mabi on us.
+			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
+			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
+		fi
+	fi
+
 	default
 
 	gnuconfig_update
@@ -775,6 +267,14 @@ src_prepare() {
 		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
 		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
 		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
+
+		if use debug ; then
+			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+			sed -i \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				debug/Makefile || die
+		fi
 	fi
 }
 
@@ -786,7 +286,7 @@ glibc_do_configure() {
 	# we accumulate crap across abis
 	unset CXX
 
-	einfo "Configuring glibc for nptl"
+	einfo "Configuring glibc for $1"
 
 	if use doc ; then
 		export MAKEINFO=makeinfo
@@ -811,6 +311,18 @@ glibc_do_configure() {
 
 	local myconf=()
 
+	# set addons
+	pushd "${S}" > /dev/null
+	local addons=$(echo */configure | sed \
+		-e 's:/configure::g' \
+		-e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
+		-e 's: \+$::' \
+		-e 's! !,!g' \
+		-e 's!^!,!' \
+		-e '/^,\*$/d')
+	[[ -d ports ]] && addons+=",ports"
+	popd > /dev/null
+
 	case ${CTARGET} in
 		powerpc-*)
 			# Currently gcc on powerpc32 generates invalid code for
@@ -839,7 +351,12 @@ glibc_do_configure() {
 
 	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
 
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+	if [[ $1 == "nptl" ]] ; then
+		myconf+=( --enable-kernel=${NPTL_KERN_VER} )
+	else
+		die "invalid pthread option"
+	fi
+	myconf+=( --enable-add-ons="${addons#,}" )
 
 	# Since SELinux support is only required for nscd, only enable it if:
 	# 1. USE selinux
@@ -908,7 +425,7 @@ glibc_do_configure() {
 	# this overriding check.  #347761
 	export libc_cv_hashstyle=no
 
-	local builddir=$(builddir nptl)
+	local builddir=$(builddir "$1")
 	mkdir -p "${builddir}"
 	cd "${builddir}"
 	set -- "${S}"/configure "${myconf[@]}"
@@ -929,11 +446,10 @@ glibc_do_configure() {
 	# to lie and use a local copy of gcc.  Like if the system
 	# is built with MULTILIB_ABIS="amd64 x86" but we want to
 	# add x32 to it, gcc/glibc don't yet support x32.
-	#
 	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
 		echo 'main(){}' > "${T}"/test.c
 		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
 		fi
 	fi
 }
@@ -954,7 +470,6 @@ glibc_headers_configure() {
 		libc_cv_asm_cfi_directives=yes
 		libc_cv_broken_visibility_attribute=no
 		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
 		libc_cv_forced_unwind=yes
 		libc_cv_gcc___thread=yes
 		libc_cv_mlong_double_128=yes
@@ -962,7 +477,6 @@ glibc_headers_configure() {
 		libc_cv_ppc_machine=yes
 		libc_cv_ppc_rel16=yes
 		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
 		libc_cv_visibility_attribute=yes
 		libc_cv_z_combreloc=yes
 		libc_cv_z_execstack=yes
@@ -983,8 +497,6 @@ glibc_headers_configure() {
 		export ${v}
 	done
 
-	local headers_only_arch_CPPFLAGS=()
-
 	# Blow away some random CC settings that screw things up. #550192
 	if [[ -d ${S}/sysdeps/mips ]]; then
 		pushd "${S}"/sysdeps/mips >/dev/null
@@ -1001,25 +513,6 @@ glibc_headers_configure() {
 		popd >/dev/null
 	fi
 
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
 	local myconf=()
 	myconf+=(
 		--disable-sanity-checks
@@ -1034,11 +527,15 @@ glibc_headers_configure() {
 		${EXTRA_ECONF}
 	)
 
+	local addons
+	[[ -d ${S}/ports ]] && addons+=",ports"
+	myconf+=( --enable-add-ons="${addons#,}" )
+
 	# Nothing is compiled here which would affect the headers for the target.
 	# So forcing CC/CFLAGS is sane.
 	local headers_only_CC=$(tc-getBUILD_CC)
 	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE"
 	local headers_only_LDFLAGS=""
 	set -- "${S}"/configure "${myconf[@]}"
 	echo \
@@ -1079,14 +576,14 @@ src_compile() {
 }
 
 glibc_src_test() {
-	cd "$(builddir nptl)"
+	cd "$(builddir $1)"
 	emake check
 }
 
 do_src_test() {
 	local ret=0
 
-	glibc_src_test
+	glibc_src_test nptl
 	: $(( ret |= $? ))
 
 	return ${ret}
@@ -1096,26 +593,12 @@ src_test() {
 	if just_headers ; then
 		return
 	fi
-
 	# Give tests more time to complete.
 	export TIMEOUTFACTOR=5
 
 	foreach_abi do_src_test || die "tests failed"
 }
 
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-		locale_list="${root}/usr/share/i18n/SUPPORTED"
-	fi
-
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-}
-
 glibc_do_src_install() {
 	local builddir=$(builddir nptl)
 	cd "${builddir}"
@@ -1274,19 +757,13 @@ glibc_do_src_install() {
 	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
 	doenvd "${T}"/00glibc
 
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+	for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
 		[[ -s ${d} ]] && dodoc ${d}
 	done
-	dodoc -r ChangeLog.old
 
 	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
 	# creation of the "factory" symlink in pkg_postinst().
 	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
-	fi
 }
 
 glibc_headers_install() {
@@ -1303,23 +780,6 @@ glibc_headers_install() {
 	dosym usr/include $(alt_prefix)/sys-include
 }
 
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
 src_install() {
 	if just_headers ; then
 		export ABI=default
@@ -1331,43 +791,6 @@ src_install() {
 	src_strip
 }
 
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
 pkg_preinst() {
 	# nothing to do if just installing headers
 	just_headers && return
@@ -1400,7 +823,13 @@ pkg_postinst() {
 		# errors from this step #253697
 		/sbin/telinit U 2>/dev/null
 
-		use compile-locales || run_locale_gen "${EROOT}"
+		# if the host locales.gen contains no entries, we'll install everything
+		local locale_list="${EROOT}etc/locale.gen"
+		if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+			ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+			locale_list="${EROOT}usr/share/i18n/SUPPORTED"
+		fi
+		locale-gen -j $(makeopts_jobs) --config "${locale_list}"
 	fi
 
 	# Check for sanity of /etc/nsswitch.conf, take 2

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.27-r2.ebuild
similarity index 98%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.27-r2.ebuild
index ca23762e8d4..b45dd3a4921 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r2.ebuild
@@ -25,15 +25,15 @@ fi
 
 RELEASE_VER=${PV}
 
-GCC_BOOTSTRAP_VER="4.7.3-r1"
+GCC_BOOTSTRAP_VER=20180501
 
 # Gentoo patchset
-PATCH_VER=5
+PATCH_VER=1
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla"
+IUSE="audit caps compile-locales debug doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -730,7 +730,7 @@ src_unpack() {
 	# Consistency is not guaranteed between pkg_ and src_ ...
 	sanity_prechecks
 
-	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
 
 	setup_env
 
@@ -775,6 +775,14 @@ src_prepare() {
 		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
 		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
 		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
+
+		if use debug ; then
+			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+			sed -i \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+				debug/Makefile || die
+		fi
 	fi
 }
 
@@ -933,7 +941,7 @@ glibc_do_configure() {
 	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
 		echo 'main(){}' > "${T}"/test.c
 		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
 		fi
 	fi
 }

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ca23762e8d4..7c5d09ab85a 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -25,13 +25,13 @@ fi
 
 RELEASE_VER=${PV}
 
-GCC_BOOTSTRAP_VER="4.7.3-r1"
+GCC_BOOTSTRAP_VER=20180501
 
 # Gentoo patchset
 PATCH_VER=5
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
 IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla"
 
@@ -730,7 +730,7 @@ src_unpack() {
 	# Consistency is not guaranteed between pkg_ and src_ ...
 	sanity_prechecks
 
-	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
 
 	setup_env
 
@@ -933,7 +933,7 @@ glibc_do_configure() {
 	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
 		echo 'main(){}' > "${T}"/test.c
 		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
 		fi
 	fi
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-05-05 18:18 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-05-05 18:18 UTC (permalink / raw
  To: gentoo-commits

commit:     8a44ba018c02b632ab8424727f63f2d0ef13b81b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat May  5 18:18:32 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat May  5 18:18:32 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8a44ba01

sys-libs/glibc: Remove remaining occurrences of in_iuse

Package-Manager: Portage-2.3.36, Repoman-2.3.9

 sys-libs/glibc/glibc-2.19-r2.ebuild | 10 +++++-----
 sys-libs/glibc/glibc-2.27-r2.ebuild | 10 +++++-----
 sys-libs/glibc/glibc-9999.ebuild    | 10 +++++-----
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index 1b071fb4d3d..b2b9a397b55 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -895,8 +895,8 @@ glibc_do_configure() {
 		--with-bugurl=https://bugs.gentoo.org/
 		--with-pkgversion="$(glibc_banner)"
 		$(use_multiarch || echo --disable-multi-arch)
-		$(in_iuse systemtap && use_enable systemtap)
-		$(in_iuse nscd && use_enable nscd)
+		$(use_enable systemtap)
+		$(use_enable nscd)
 		${EXTRA_ECONF}
 	)
 
@@ -904,8 +904,8 @@ glibc_do_configure() {
 	myconf+=( $(use_enable vanilla timezone-tools) )
 
 	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
 
 	# There is no configure option for this and we need to export it
 	# since the glibc build will re-run configure on itself
@@ -1174,7 +1174,7 @@ glibc_do_src_install() {
 	# With devpts under Linux mounted properly, we do not need the pt_chown
 	# binary to be setuid.  This is because the default owners/perms will be
 	# exactly what we want.
-	if in_iuse suid && ! use suid ; then
+	if ! use suid ; then
 		find "${ED}" -name pt_chown -exec chmod -s {} +
 	fi
 

diff --git a/sys-libs/glibc/glibc-2.27-r2.ebuild b/sys-libs/glibc/glibc-2.27-r2.ebuild
index b45dd3a4921..3d2fa240025 100644
--- a/sys-libs/glibc/glibc-2.27-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r2.ebuild
@@ -894,8 +894,8 @@ glibc_do_configure() {
 		--with-bugurl=https://bugs.gentoo.org/
 		--with-pkgversion="$(glibc_banner)"
 		$(use_multiarch || echo --disable-multi-arch)
-		$(in_iuse systemtap && use_enable systemtap)
-		$(in_iuse nscd && use_enable nscd)
+		$(use_enable systemtap)
+		$(use_enable nscd)
 		${EXTRA_ECONF}
 	)
 
@@ -903,8 +903,8 @@ glibc_do_configure() {
 	myconf+=( $(use_enable vanilla timezone-tools) )
 
 	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
 
 	# There is no configure option for this and we need to export it
 	# since the glibc build will re-run configure on itself
@@ -1209,7 +1209,7 @@ glibc_do_src_install() {
 	# With devpts under Linux mounted properly, we do not need the pt_chown
 	# binary to be setuid.  This is because the default owners/perms will be
 	# exactly what we want.
-	if in_iuse suid && ! use suid ; then
+	if ! use suid ; then
 		find "${ED}" -name pt_chown -exec chmod -s {} +
 	fi
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 7c5d09ab85a..ee82933c663 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -886,8 +886,8 @@ glibc_do_configure() {
 		--with-bugurl=https://bugs.gentoo.org/
 		--with-pkgversion="$(glibc_banner)"
 		$(use_multiarch || echo --disable-multi-arch)
-		$(in_iuse systemtap && use_enable systemtap)
-		$(in_iuse nscd && use_enable nscd)
+		$(use_enable systemtap)
+		$(use_enable nscd)
 		${EXTRA_ECONF}
 	)
 
@@ -895,8 +895,8 @@ glibc_do_configure() {
 	myconf+=( $(use_enable vanilla timezone-tools) )
 
 	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
 
 	# There is no configure option for this and we need to export it
 	# since the glibc build will re-run configure on itself
@@ -1201,7 +1201,7 @@ glibc_do_src_install() {
 	# With devpts under Linux mounted properly, we do not need the pt_chown
 	# binary to be setuid.  This is because the default owners/perms will be
 	# exactly what we want.
-	if in_iuse suid && ! use suid ; then
+	if ! use suid ; then
 		find "${ED}" -name pt_chown -exec chmod -s {} +
 	fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-05-05 18:24 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-05-05 18:24 UTC (permalink / raw
  To: gentoo-commits

commit:     de37b19ab38f31db07f9aaa761fd7cc0e7748f5c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat May  5 18:24:24 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat May  5 18:24:24 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de37b19a

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.36, Repoman-2.3.9

 sys-libs/glibc/glibc-2.27-r1.ebuild | 1428 -----------------------------------
 1 file changed, 1428 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.27-r1.ebuild b/sys-libs/glibc/glibc-2.27-r1.ebuild
deleted file mode 100644
index fe60c1f83c3..00000000000
--- a/sys-libs/glibc/glibc-2.27-r1.ebuild
+++ /dev/null
@@ -1,1428 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-
-# Gentoo patchset
-PATCH_VER=1
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
-
-IUSE="audit caps compile-locales debug doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	doc? ( sys-apps/texinfo )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.9
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.9
-		virtual/os-headers
-	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparc64v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparcv9v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	filter-flags '-fstack-protector*'
-
-	# Starting with gcc-6 (and fully upstreamed pie patches) we control
-	# default enabled/disabled pie via use flags. So nothing to do
-	# here then. #618160
-	if [[ $(gcc-major-version) -lt 6 ]]; then
-		if use hardened && tc-enables-pie ; then
-			# Force PIC macro definition for all compilations since they're all
-			# either -fPIC or -fPIE with the default-PIE compiler.
-			append-cppflags -DPIC
-		else
-			# Don't build -fPIE without the default-PIE compiler and the
-			# hardened-pie patch
-			filter-flags -fPIE
-		fi
-	fi
-}
-
-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}
-}
-
-use_multiarch() {
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	version_is_at_least ${nver} ${bver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if use headers-only ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	use hardened && ! tc-enables-pie && \
-		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers ; then
-		local run_kv build_kv want_kv
-
-		run_kv=$(g_get_running_KV)
-		build_kv=$(g_int_to_KV $(get_kheader_version))
-		want_kv=${MIN_KERN_VER}
-
-		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!"
-		fi
-
-		if ! is_crosscompile && ! tc-is-cross-compiler ; then
-			# Building fails on an non-supporting kernel
-			ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-			if ! eend_KV ${run_kv} ${want_kv} ; then
-				echo
-				eerror "You need a kernel of at least ${want_kv}!"
-				die "Kernel version too low!"
-			fi
-		fi
-
-		ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-		if ! eend_KV ${build_kv} ${want_kv} ; then
-			echo
-			eerror "You need linux-headers of at least ${want_kv}!"
-			die "linux-headers version too low!"
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}" || die
-	touch locale/C-translit.h || die #185476 #218003
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-	fi
-}
-
-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 ; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-
-	# The glibc configure script doesn't properly use LDFLAGS all the time.
-	export CC="$(tc-getCC ${CTARGET}) ${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)"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=all )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(in_iuse systemtap && use_enable systemtap)
-		$(in_iuse nscd && use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-		locale_list="${root}/usr/share/i18n/SUPPORTED"
-	fi
-
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if in_iuse suid && ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		cd "${ED}"$(alt_libdir)/..
-		[[ -e lib ]] || mkdir lib
-		cd "${ED}"$(alt_usrlibdir)/..
-		[[ -e lib ]] || mkdir lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-05-06 20:49 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-05-06 20:49 UTC (permalink / raw
  To: gentoo-commits

commit:     3336345f78b135b3047ccf72c8035b82dad4e83e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun May  6 20:49:22 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun May  6 20:49:37 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3336345f

sys-libs/glibc: Restore keywords in 2.26-r7

Package-Manager: Portage-2.3.36, Repoman-2.3.9

 sys-libs/glibc/glibc-2.26-r7.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index dad9a620a2c..63fe46ce3f0 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -18,8 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-05-11 19:54 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-05-11 19:54 UTC (permalink / raw
  To: gentoo-commits

commit:     285769c9ff0fcf18d7ea25adac96010b4727a7ab
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri May 11 19:54:01 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri May 11 19:54:11 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=285769c9

sys-libs/glibc: New tarball with added ppc multilib bootstrap files

Bug: https://bugs.gentoo.org/654524
Bug: https://bugs.gentoo.org/647070
Package-Manager: Portage-2.3.36, Repoman-2.3.9

 sys-libs/glibc/Manifest             | 2 +-
 sys-libs/glibc/glibc-2.26-r7.ebuild | 2 +-
 sys-libs/glibc/glibc-2.27-r2.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 767c577845d..cef17f9efe3 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -1,5 +1,5 @@
 DIST gcc-4.7.3-r1-multilib-bootstrap.tar.bz2 8064097 BLAKE2B 3cc5c82cd57d0fbd26d9a376ee8ca02f119fe9d653311cbe4d2b7b93aec2290adac3be271be19a7fdedae2e11e4b6e32360184e557204e100ad64357f5575d4b SHA512 40b93e194ad41a75d649d84d1c49070680f253a13f0617803243bc61c44fed1ca2d0a7572a97ebb79353f312b58b5f6360be916dd7435928cc53935082e15269
-DIST gcc-multilib-bootstrap-20180501.tar.xz 2128700 BLAKE2B edeb5447bf397dfeee1295beb10b0e34253da8b3e1816720b6cfc3300a1c685fa022c3b809402a86340bbd7b9488d22cfba4c042d530dcb05ec971a2b1580d34 SHA512 eb289c44c5dcabaa727612dd685801b61e1fbe94b39024ecb3e14c73f9eaff68e05949a8f277a86c7471955cc8ec6e0127623b9861be7ac85f63226618b6c9c2
+DIST gcc-multilib-bootstrap-20180511.tar.xz 2392908 BLAKE2B f3cf614399368acd8908f60d894c6344a2fa09383b30c1633a0682bc668367c8a2f8c6fec2d41b6e2178d709a2bd8db57e8b2ab56ba263c7d56f819c15acd061 SHA512 98c766e913693ab42ff790557acde2a36a8001e2648046a685b21964200df8d4d52d8452d499c0068c6648284d086ce062c2d36e2c6c2fd8aacd232d193f2853
 DIST glibc-2.18-patches-4.tar.bz2 95165 BLAKE2B 70280e0f5fd0b1ee13cd0464aafaa9c9324528d0bee8024e6529d67d908991012066db6d8257b66983a1f52e32b3aad7718612fdab9ea199fef845db93347168 SHA512 d881c9c5fe32b967694d4ca5185ff5ffc964449f2ed49fd062e5d57a3c6d9f16eef2f591d2d8e98a1a95a6487f3436ef031839ed8766fd085404b288340b7933
 DIST glibc-2.18.tar.xz 11150148 BLAKE2B 7848a5a50abedbd17085e05b6f6835959adb5e55a424d95fa8a49eeec999a6dd81a9382db85ef7e852ef1d7743c5d312dccbf42024e95edf0e802eb32928dfe5 SHA512 27218d2e7dd3bf3908d7af171c490933680e958c579ebd27b43b661e223fd5de2219cc1cf699170405280808c84de476d0ad86dbba35a488ef404e9438552327
 DIST glibc-2.19-patches-3.tar.bz2 80664 BLAKE2B fb348c711941c1bd4dadd905e172dc4f239d8b63af1a1d14dcf4ec45c504bd47e10e9b24b38f9e01796016f2e97caeeb693213ae08147274ed0a4d9501293be0 SHA512 d281d6a2757920124cf8a3f02b97e75192598b08d96ae48840df34c7ffdcb212952d171f233e6f12a429b19437d0a296212fe1f2eae164d6a1c6793cb3cb69f0

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index 63fe46ce3f0..142e681f5b9 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -24,7 +24,7 @@ fi
 
 RELEASE_VER=${PV}
 
-GCC_BOOTSTRAP_VER=20180501
+GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
 PATCH_VER=7

diff --git a/sys-libs/glibc/glibc-2.27-r2.ebuild b/sys-libs/glibc/glibc-2.27-r2.ebuild
index 3d2fa240025..f21bc24c5d9 100644
--- a/sys-libs/glibc/glibc-2.27-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r2.ebuild
@@ -25,7 +25,7 @@ fi
 
 RELEASE_VER=${PV}
 
-GCC_BOOTSTRAP_VER=20180501
+GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
 PATCH_VER=1

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ee82933c663..a3120178c7f 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -25,7 +25,7 @@ fi
 
 RELEASE_VER=${PV}
 
-GCC_BOOTSTRAP_VER=20180501
+GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
 PATCH_VER=5


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-05-19 23:38 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-05-19 23:38 UTC (permalink / raw
  To: gentoo-commits

commit:     8530febc54e83682dcf87fe26e8cc04130ab44ca
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat May 19 23:37:42 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat May 19 23:38:08 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8530febc

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.36, Repoman-2.3.9

 sys-libs/glibc/glibc-2.26-r6.ebuild | 848 ------------------------------------
 1 file changed, 848 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.26-r6.ebuild b/sys-libs/glibc/glibc-2.26-r6.ebuild
deleted file mode 100644
index 0922ffb404f..00000000000
--- a/sys-libs/glibc/glibc-2.26-r6.ebuild
+++ /dev/null
@@ -1,848 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix toolchain-glibc
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-
-# Gentoo patchset
-PATCH_VER=7
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
-
-IUSE="audit caps debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
-
-# Min kernel version glibc requires
-: ${NPTL_KERN_VER:="3.2.0"}
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	doc? ( sys-apps/texinfo )
-"
-RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.9
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.9
-		virtual/os-headers
-	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# the phases
-#
-
-pkg_pretend() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-		# The high rev # is to allow people to downgrade between -r# versions.
-		# We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine.
-		# Hopefully we never actually use a r# this high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction"
-			die "Aborting to save your system"
-		fi
-
-		if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
-		then
-			eerror "Your patched vendor kernel is broken.  You need to get an"
-			eerror "update from whoever is providing the kernel to you."
-			eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227"
-			eerror "https://bugs.gentoo.org/262698"
-			die "Keeping your system alive, say thank you"
-		fi
-
-		if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
-		then
-			eerror "Your old kernel is broken.  You need to update it to"
-			eerror "a newer version as syscall(<bignum>) will break."
-			eerror "https://bugs.gentoo.org/279260"
-			die "Keeping your system alive, say thank you"
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	use hardened && ! tc-enables-pie && \
-		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
-
-	# Make sure host system is up to date #394453
-	if has_version '<sys-libs/glibc-2.13' && \
-	   [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]]
-	then
-		ebegin "Scanning system for __guard to see if you need to rebuild first ..."
-		local files=$(
-			scanelf -qys__guard -F'#s%F' \
-				"${EROOT}"/*bin/ \
-				"${EROOT}"/lib* \
-				"${EROOT}"/usr/*bin/ \
-				"${EROOT}"/usr/lib* | \
-				egrep -v \
-					-e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \
-					-e "^${EROOT}/sbin/(ldconfig|sln)$"
-		)
-		[[ -z ${files} ]]
-		if ! eend $? ; then
-			eerror "Your system still has old SSP __guard symbols.  You need to"
-			eerror "rebuild all the packages that provide these files first:"
-			eerror "${files}"
-			die "old __guard detected"
-		fi
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-}
-
-src_unpack() {
-	use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	setup_env
-
-	# Check NPTL support _before_ we unpack things to save some time
-	check_nptl_support
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}"
-	touch locale/C-translit.h #185476 #218003
-
-	cd "${WORKDIR}"
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	if just_headers ; then
-		if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
-			# mips peeps like to screw with us.  if building headers,
-			# we don't have a real compiler, so we can't let them
-			# insert -mabi on us.
-			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
-			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
-		fi
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-	fi
-}
-
-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 $1"
-
-	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 ; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-
-	# The glibc configure script doesn't properly use LDFLAGS all the time.
-	export CC="$(tc-getCC ${CTARGET}) ${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)"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	# set addons
-	pushd "${S}" > /dev/null
-	local addons=$(echo */configure | sed \
-		-e 's:/configure::g' \
-		-e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
-		-e 's: \+$::' \
-		-e 's! !,!g' \
-		-e 's!^!,!' \
-		-e '/^,\*$/d')
-	[[ -d ports ]] && addons+=",ports"
-	popd > /dev/null
-
-	case ${CTARGET} in
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=all )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	if [[ $1 == "nptl" ]] ; then
-		myconf+=( --enable-kernel=${NPTL_KERN_VER} )
-	else
-		die "invalid pthread option"
-	fi
-	myconf+=( --enable-add-ons="${addons#,}" )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(in_iuse systemtap && use_enable systemtap)
-		$(in_iuse nscd && use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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 "$1")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	local addons
-	[[ -d ${S}/ports ]] && addons+=",ports"
-	myconf+=( --enable-add-ons="${addons#,}" )
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir $1)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test nptl
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if in_iuse suid && ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		cd "${ED}"$(alt_libdir)/..
-		[[ -e lib ]] || mkdir lib
-		cd "${ED}"$(alt_usrlibdir)/..
-		[[ -e lib ]] || mkdir lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		# if the host locales.gen contains no entries, we'll install everything
-		local locale_list="${EROOT}etc/locale.gen"
-		if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-			ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-			locale_list="${EROOT}usr/share/i18n/SUPPORTED"
-		fi
-		locale-gen -j $(makeopts_jobs) --config "${locale_list}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-05-20 16:06 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-05-20 16:06 UTC (permalink / raw
  To: gentoo-commits

commit:     134eb78addb5db67d99bc8e3580b68b38343512d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun May 20 16:04:55 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun May 20 16:05:53 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=134eb78a

sys-libs/glibc: Stop installing SSP and FORTIFY_SOURCE handler

[12:38:42] <Zorry> dilfridge: you can remove the einfo "Installing
           Hardened Gentoo SSP and FORTIFY_SOURCE handler" and cp files too
[12:38:53] <Zorry> for glibc
[12:50:17] <dilfridge> ok
[12:50:20] <dilfridge> will do

Closes: https://bugs.gentoo.org/601718
Package-Manager: Portage-2.3.36, Repoman-2.3.9

 sys-libs/glibc/glibc-9999.ebuild | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a3120178c7f..d628938b2a7 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -767,15 +767,6 @@ src_prepare() {
 	chmod u+x "${S}"/scripts/*.sh
 
 	cd "${S}"
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-	fi
 }
 
 glibc_do_configure() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-05-20 23:47 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-05-20 23:47 UTC (permalink / raw
  To: gentoo-commits

commit:     c0e40e728746b3a1f7a55ff1d7ed259d1797538e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun May 20 23:47:02 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun May 20 23:47:36 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c0e40e72

sys-libs/glibc: Revision bump, patchlevel 2, many upstream fixes

Package-Manager: Portage-2.3.36, Repoman-2.3.9

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.27-r3.ebuild | 1411 +++++++++++++++++++++++++++++++++++
 2 files changed, 1412 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index cef17f9efe3..b621df80528 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,5 +20,6 @@ DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1
 DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b217391156f897a8db50f65a69627d8f8cceded78414168986ee98eba038364a6b2f3599b23f95e7b0ad2643481c399718 SHA512 0c812a343fcc68c10d92117cb2a0cf1c255470e81f0a7a04d6db2fe35445e410ef37f15162f145c2eb772b08ab55af246f5b52f5e57c2e91038181f6f027abc3
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
 DIST glibc-2.27-patches-1.tar.bz2 15950 BLAKE2B ef2d2ede447b98c5e20f1bf1328f1379fd781b603a888f0fd7f1dbb6172e42222c9198d61dd75d9aafbed5c395a277a3c0d00ef4b70932fafb500b111e013963 SHA512 9e3ed7e271313c104eefcd383e6259c235b4e2f7a41be2ba8a1bfb469f8f54835ffde63ae89fa40af47b444911addb0db002a05d033bcc2832710b51650c91e3
+DIST glibc-2.27-patches-2.tar.bz2 129983 BLAKE2B fad8d14f5330bc301804913f92f48051583f122cc83ab44813dc13498f59e97b38d1b276353eed9df3fde427b669cf9168632bbed8d006a3d4995c1df79575a4 SHA512 b05e34dbb45aaadfdcc079888ef2b2f70b181ba31edf2e2bbd18fa666375f5c6c48993830a305de0706b4a562db6403b6287bcab4789c1c37bc535216ee9f4cd
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-9999-patches-5.tar.bz2 15979 BLAKE2B f59b4d7096fd876c9176f6ebdd9a4a510f3c6c90dd69a1fbb092a18f296767759d8d73dc7a81e29e3f6152043a4179056d5e224896c7bb96cc09ede2e2dd16e1 SHA512 c29ad59977b2c4dfd58ee16d0898a1c16e6cde974d5c29c3a7a55e0dee4ade7f1a3d45c9481c1d35df7fcedbdb67267f5d61759cacab677b6288b5ece3871a4b

diff --git a/sys-libs/glibc/glibc-2.27-r3.ebuild b/sys-libs/glibc/glibc-2.27-r3.ebuild
new file mode 100644
index 00000000000..8d6226b6119
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.27-r3.ebuild
@@ -0,0 +1,1411 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=2
+
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	!<sys-devel/bison-2.7
+	doc? ( sys-apps/texinfo )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+	!sys-kernel/ps3-sources
+	!sys-libs/nss-db
+"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.9
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.9
+		virtual/os-headers
+	"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake -s glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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' 2>/dev/null ; then
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		amd64)
+			# -march needed for #185404 #199334
+			# Note: This test only matters when the x86 ABI is enabled, so we could
+			# optimize a bit and elide it.
+			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if version_is_at_least 2.8 ; then
+						cpu="sparc64v2"
+					elif version_is_at_least 2.4 ; then
+						cpu="sparc64v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if version_is_at_least 2.4 ; then
+						cpu="sparc64v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if version_is_at_least 2.8 ; then
+						cpu="sparcv9v2"
+					elif version_is_at_least 2.4 ; then
+						cpu="sparcv9v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if version_is_at_least 2.4 ; then
+						cpu="sparcv9v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Over-zealous CFLAGS can often cause problems.  What may work for one
+	# person may not work for another.  To avoid a large influx of bugs
+	# relating to failed builds, we strip most CFLAGS out to ensure as few
+	# problems as possible.
+	strip-flags
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# Lock glibc at -O2; we want to be conservative here.
+	# -fno-strict-aliasing is to work around #155906.
+	filter-flags '-O?'
+	append-flags -O2 -fno-strict-aliasing
+
+	filter-flags '-fstack-protector*'
+
+	# Starting with gcc-6 (and fully upstreamed pie patches) we control
+	# default enabled/disabled pie via use flags. So nothing to do
+	# here then. #618160
+	if [[ $(gcc-major-version) -lt 6 ]]; then
+		if use hardened && tc-enables-pie ; then
+			# Force PIC macro definition for all compilations since they're all
+			# either -fPIC or -fPIE with the default-PIE compiler.
+			append-cppflags -DPIC
+		else
+			# Don't build -fPIE without the default-PIE compiler and the
+			# hardened-pie patch
+			filter-flags -fPIE
+		fi
+	fi
+}
+
+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}
+}
+
+use_multiarch() {
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	version_is_at_least ${nver} ${bver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if use headers-only ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ ${ROOT} != "/" ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ ${ROOT} == "/" ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	use hardened && ! tc-enables-pie && \
+		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	if ! just_headers ; then
+		local run_kv build_kv want_kv
+
+		run_kv=$(g_get_running_KV)
+		build_kv=$(g_int_to_KV $(get_kheader_version))
+		want_kv=${MIN_KERN_VER}
+
+		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!"
+		fi
+
+		if ! is_crosscompile && ! tc-is-cross-compiler ; then
+			# Building fails on an non-supporting kernel
+			ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+			if ! eend_KV ${run_kv} ${want_kv} ; then
+				echo
+				eerror "You need a kernel of at least ${want_kv}!"
+				die "Kernel version too low!"
+			fi
+		fi
+
+		ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+		if ! eend_KV ${build_kv} ${want_kv} ; then
+			echo
+			eerror "You need linux-headers of at least ${want_kv}!"
+			die "linux-headers version too low!"
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${S}" || die
+	touch locale/C-translit.h || die #185476 #218003
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+
+	# The glibc configure script doesn't properly use LDFLAGS all the time.
+	export CC="$(tc-getCC ${CTARGET}) ${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)"
+	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=all )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		--sysconfdir="${EPREFIX}/etc"
+		--localstatedir="${EPREFIX}/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="${EPREFIX}/sbin"
+	export libc_cv_slibdir="${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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local locale_list="${root}/etc/locale.gen"
+	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+		locale_list="${root}/usr/share/i18n/SUPPORTED"
+	fi
+
+	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}$(alt_prefix)" install || die
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		cd "${ED}"$(alt_libdir)/..
+		[[ -e lib ]] || mkdir lib
+		cd "${ED}"$(alt_usrlibdir)/..
+		[[ -e lib ]] || mkdir lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen "${ED}"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_strip() {
+	# gdb is lame and requires some debugging information to remain in
+	# libpthread, so we need to strip it by hand.  libthread_db makes no
+	# sense stripped as it is only used when debugging.
+	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
+	env \
+		-uRESTRICT \
+		CHOST=${CTARGET} \
+		STRIP_MASK="/*/{,tls/}${pthread}*" \
+		prepallstrip
+	# if user has stripping enabled and does not have split debug turned on,
+	# then leave the debugging sections in libpthread.
+	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
+		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
+	fi
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+	src_strip
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ ${ROOT} != "/" ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+	fi
+
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		use compile-locales || run_locale_gen "${EROOT}"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-05-22 14:35 Mike Frysinger
  0 siblings, 0 replies; 1076+ messages in thread
From: Mike Frysinger @ 2018-05-22 14:35 UTC (permalink / raw
  To: gentoo-commits

commit:     40259e04ced6e79108fb80cf24819c4bf31f394b
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue May 22 14:35:41 2018 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue May 22 14:35:49 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=40259e04

sys-libs/glibc: mark 2.23-r4/2.25-r11 m68k/s390/sh stable

 sys-libs/glibc/glibc-2.23-r4.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.25-r11.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.23-r4.ebuild b/sys-libs/glibc/glibc-2.23-r4.ebuild
index 18fe392f108..83000a9d662 100644
--- a/sys-libs/glibc/glibc-2.23-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.23-r4.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index 6e74ceffe23..db95b9d9ab6 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
 RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-02 19:28 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-06-02 19:28 UTC (permalink / raw
  To: gentoo-commits

commit:     883ee089290a61caa2cd55ea73125c7c9408ec0d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jun  2 18:57:17 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jun  2 19:27:10 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=883ee089

sys-libs/glibc: 2.26-r7 stable for amd64, bug 657148

Bug: https://bugs.gentoo.org/657148
Package-Manager: Portage-2.3.38, Repoman-2.3.9

 sys-libs/glibc/glibc-2.26-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index 142e681f5b9..fc0a3b66d00 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-02 21:48 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-06-02 21:48 UTC (permalink / raw
  To: gentoo-commits

commit:     7fd37133c40c4ef5080d941b34a57757d1e88ab3
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Jun  2 21:46:35 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Jun  2 21:47:47 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7fd37133

sys-libs/glibc: stable 2.26-r7 for ia64, bug #657148

Bug: https://bugs.gentoo.org/657148
Package-Manager: Portage-2.3.38, Repoman-2.3.9
RepoMan-Options: --include-arches="ia64"

 sys-libs/glibc/glibc-2.26-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index fc0a3b66d00..fbee4794393 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-04 23:40 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-06-04 23:40 UTC (permalink / raw
  To: gentoo-commits

commit:     598ebdff68f88ab20aae8fba997563ef4d66f3af
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  4 23:37:04 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jun  4 23:40:03 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=598ebdff

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.27-r2.ebuild | 1428 -----------------------------------
 2 files changed, 1429 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index b621df80528..b2dbe0f7f4f 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,7 +19,6 @@ DIST glibc-2.25-patches-15.tar.bz2 78320 BLAKE2B 70c62cc10db13e2844de4d8a18972e0
 DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
 DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b217391156f897a8db50f65a69627d8f8cceded78414168986ee98eba038364a6b2f3599b23f95e7b0ad2643481c399718 SHA512 0c812a343fcc68c10d92117cb2a0cf1c255470e81f0a7a04d6db2fe35445e410ef37f15162f145c2eb772b08ab55af246f5b52f5e57c2e91038181f6f027abc3
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
-DIST glibc-2.27-patches-1.tar.bz2 15950 BLAKE2B ef2d2ede447b98c5e20f1bf1328f1379fd781b603a888f0fd7f1dbb6172e42222c9198d61dd75d9aafbed5c395a277a3c0d00ef4b70932fafb500b111e013963 SHA512 9e3ed7e271313c104eefcd383e6259c235b4e2f7a41be2ba8a1bfb469f8f54835ffde63ae89fa40af47b444911addb0db002a05d033bcc2832710b51650c91e3
 DIST glibc-2.27-patches-2.tar.bz2 129983 BLAKE2B fad8d14f5330bc301804913f92f48051583f122cc83ab44813dc13498f59e97b38d1b276353eed9df3fde427b669cf9168632bbed8d006a3d4995c1df79575a4 SHA512 b05e34dbb45aaadfdcc079888ef2b2f70b181ba31edf2e2bbd18fa666375f5c6c48993830a305de0706b4a562db6403b6287bcab4789c1c37bc535216ee9f4cd
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-9999-patches-5.tar.bz2 15979 BLAKE2B f59b4d7096fd876c9176f6ebdd9a4a510f3c6c90dd69a1fbb092a18f296767759d8d73dc7a81e29e3f6152043a4179056d5e224896c7bb96cc09ede2e2dd16e1 SHA512 c29ad59977b2c4dfd58ee16d0898a1c16e6cde974d5c29c3a7a55e0dee4ade7f1a3d45c9481c1d35df7fcedbdb67267f5d61759cacab677b6288b5ece3871a4b

diff --git a/sys-libs/glibc/glibc-2.27-r2.ebuild b/sys-libs/glibc/glibc-2.27-r2.ebuild
deleted file mode 100644
index f21bc24c5d9..00000000000
--- a/sys-libs/glibc/glibc-2.27-r2.ebuild
+++ /dev/null
@@ -1,1428 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=1
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps compile-locales debug doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	doc? ( sys-apps/texinfo )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.9
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.9
-		virtual/os-headers
-	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparc64v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparcv9v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	filter-flags '-fstack-protector*'
-
-	# Starting with gcc-6 (and fully upstreamed pie patches) we control
-	# default enabled/disabled pie via use flags. So nothing to do
-	# here then. #618160
-	if [[ $(gcc-major-version) -lt 6 ]]; then
-		if use hardened && tc-enables-pie ; then
-			# Force PIC macro definition for all compilations since they're all
-			# either -fPIC or -fPIE with the default-PIE compiler.
-			append-cppflags -DPIC
-		else
-			# Don't build -fPIE without the default-PIE compiler and the
-			# hardened-pie patch
-			filter-flags -fPIE
-		fi
-	fi
-}
-
-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}
-}
-
-use_multiarch() {
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	version_is_at_least ${nver} ${bver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if use headers-only ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	use hardened && ! tc-enables-pie && \
-		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers ; then
-		local run_kv build_kv want_kv
-
-		run_kv=$(g_get_running_KV)
-		build_kv=$(g_int_to_KV $(get_kheader_version))
-		want_kv=${MIN_KERN_VER}
-
-		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!"
-		fi
-
-		if ! is_crosscompile && ! tc-is-cross-compiler ; then
-			# Building fails on an non-supporting kernel
-			ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-			if ! eend_KV ${run_kv} ${want_kv} ; then
-				echo
-				eerror "You need a kernel of at least ${want_kv}!"
-				die "Kernel version too low!"
-			fi
-		fi
-
-		ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-		if ! eend_KV ${build_kv} ${want_kv} ; then
-			echo
-			eerror "You need linux-headers of at least ${want_kv}!"
-			die "linux-headers version too low!"
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}" || die
-	touch locale/C-translit.h || die #185476 #218003
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-	fi
-}
-
-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 ; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-
-	# The glibc configure script doesn't properly use LDFLAGS all the time.
-	export CC="$(tc-getCC ${CTARGET}) ${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)"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=all )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-		locale_list="${root}/usr/share/i18n/SUPPORTED"
-	fi
-
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		cd "${ED}"$(alt_libdir)/..
-		[[ -e lib ]] || mkdir lib
-		cd "${ED}"$(alt_usrlibdir)/..
-		[[ -e lib ]] || mkdir lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-04 23:40 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-06-04 23:40 UTC (permalink / raw
  To: gentoo-commits

commit:     956411cb2fb0c68d0982343f9bbaa4ebb082c2c2
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  4 23:39:21 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jun  4 23:40:03 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=956411cb

sys-libs/glibc: Drop glibc-2.18

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/Manifest             |   2 -
 sys-libs/glibc/glibc-2.18-r1.ebuild | 164 ------------------------------------
 2 files changed, 166 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index b2dbe0f7f4f..a7b01a7e57f 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -1,7 +1,5 @@
 DIST gcc-4.7.3-r1-multilib-bootstrap.tar.bz2 8064097 BLAKE2B 3cc5c82cd57d0fbd26d9a376ee8ca02f119fe9d653311cbe4d2b7b93aec2290adac3be271be19a7fdedae2e11e4b6e32360184e557204e100ad64357f5575d4b SHA512 40b93e194ad41a75d649d84d1c49070680f253a13f0617803243bc61c44fed1ca2d0a7572a97ebb79353f312b58b5f6360be916dd7435928cc53935082e15269
 DIST gcc-multilib-bootstrap-20180511.tar.xz 2392908 BLAKE2B f3cf614399368acd8908f60d894c6344a2fa09383b30c1633a0682bc668367c8a2f8c6fec2d41b6e2178d709a2bd8db57e8b2ab56ba263c7d56f819c15acd061 SHA512 98c766e913693ab42ff790557acde2a36a8001e2648046a685b21964200df8d4d52d8452d499c0068c6648284d086ce062c2d36e2c6c2fd8aacd232d193f2853
-DIST glibc-2.18-patches-4.tar.bz2 95165 BLAKE2B 70280e0f5fd0b1ee13cd0464aafaa9c9324528d0bee8024e6529d67d908991012066db6d8257b66983a1f52e32b3aad7718612fdab9ea199fef845db93347168 SHA512 d881c9c5fe32b967694d4ca5185ff5ffc964449f2ed49fd062e5d57a3c6d9f16eef2f591d2d8e98a1a95a6487f3436ef031839ed8766fd085404b288340b7933
-DIST glibc-2.18.tar.xz 11150148 BLAKE2B 7848a5a50abedbd17085e05b6f6835959adb5e55a424d95fa8a49eeec999a6dd81a9382db85ef7e852ef1d7743c5d312dccbf42024e95edf0e802eb32928dfe5 SHA512 27218d2e7dd3bf3908d7af171c490933680e958c579ebd27b43b661e223fd5de2219cc1cf699170405280808c84de476d0ad86dbba35a488ef404e9438552327
 DIST glibc-2.19-patches-3.tar.bz2 80664 BLAKE2B fb348c711941c1bd4dadd905e172dc4f239d8b63af1a1d14dcf4ec45c504bd47e10e9b24b38f9e01796016f2e97caeeb693213ae08147274ed0a4d9501293be0 SHA512 d281d6a2757920124cf8a3f02b97e75192598b08d96ae48840df34c7ffdcb212952d171f233e6f12a429b19437d0a296212fe1f2eae164d6a1c6793cb3cb69f0
 DIST glibc-2.19-patches-9.tar.bz2 24584 BLAKE2B a96e930a5bd20fa75d9f259cc2117fa5ce98072274a24a5823bf877e3739fa4c001a94d7865e065ee0527f3974430d27da8038e042340a451ad2052c62724f26 SHA512 a95b3063ade974a3556480b798b317d33c7423a8cb9e69f67249ffb8b3d3c671d70d2d5f782c1efadc0bec4cc49a96d4fe89911f3dfcd85b459f69f3b4f38f0e
 DIST glibc-2.19.tar.xz 12083312 BLAKE2B 9dc03346e0f0df4bf009a92d894b0a9f964ff92b7f4c9663cedf1cb6cf90435f28a15539d33791ecf43ee578fa4e26f916af0367651312ef8f9c1c38ce0dafa2 SHA512 9e021fcb3afbb9ace2a0e37fded231a62de861bd766e29d47163a03182e37add718b7acc3963d1c525f9556773e842297725715acde48dcfbaab6e756af1a23d

diff --git a/sys-libs/glibc/glibc-2.18-r1.ebuild b/sys-libs/glibc/glibc-2.18-r1.ebuild
deleted file mode 100644
index d699096c66f..00000000000
--- a/sys-libs/glibc/glibc-2.18-r1.ebuild
+++ /dev/null
@@ -1,164 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=0
-
-inherit toolchain-glibc
-
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-RESTRICT="strip" # strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-RELEASE_VER=""
-case ${PV} in
-9999*)
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
-	;;
-*)
-	RELEASE_VER=${PV}
-	;;
-esac
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-PATCH_VER="4"                                  # Gentoo patchset
-NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.16"}       # min kernel version nptl requires
-
-IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-[[ ${CTARGET} == hppa* ]] && NPTL_KERN_VER=${NPTL_KERN_VER/2.6.16/2.6.20}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-DEPEND=">=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	selinux? ( sys-libs/libselinux )"
-RDEPEND="!sys-kernel/ps3-sources
-	selinux? ( sys-libs/libselinux )
-	!sys-libs/nss-db"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.20
-		>=${CATEGORY}/gcc-4.3
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.20
-		>=sys-devel/gcc-4.3
-		virtual/os-headers
-		!vanilla? ( >=sys-libs/timezone-data-2012c )"
-	RDEPEND+="
-		vanilla? ( !sys-libs/timezone-data )
-		!vanilla? ( sys-libs/timezone-data )"
-fi
-
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
-}
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
-
-src_unpack() {
-	GLIBC_PATCH_EXCLUDE+=" 00_all_0012-mips-add-clock_-g-s-ettime-symbol-compat-hacks.patch" #456912 #481438
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	toolchain-glibc_src_unpack
-
-	if use hardened ; then
-		cd "${S}"
-		einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
-		tc-enables-pie && epatch "${FILESDIR}"/2.17/glibc-2.17-hardened-pie.patch
-		epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-configure-picdefault.patch
-		epatch "${FILESDIR}"/2.18/glibc-2.18-hardened-inittls-nosysenter.patch
-
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp -f "${FILESDIR}"/2.18/glibc-2.18-gentoo-stack_chk_fail.c \
-			debug/stack_chk_fail.c || die
-		cp -f "${FILESDIR}"/2.18/glibc-2.18-gentoo-chk_fail.c \
-			debug/chk_fail.c || die
-
-		if use debug ; then
-			# When using Hardened Gentoo stack handler, have smashes dump core for
-			# analysis - debug only, as core could be an information leak
-			# (paranoia).
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile \
-				|| die "Failed to modify debug/Makefile for debug stack handler"
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile \
-				|| die "Failed to modify debug/Makefile for debug fortify handler"
-		fi
-
-		# Build nscd with ssp-all
-		sed -i \
-			-e 's:-fstack-protector$:-fstack-protector-all:' \
-			nscd/Makefile \
-			|| die "Failed to ensure nscd builds with ssp-all"
-	fi
-}
-
-pkg_preinst() {
-	toolchain-glibc_pkg_preinst
-
-	if [[ ${CTARGET} == arm* ]] ; then
-		# Backwards compat support for renaming hardfp ldsos #417287
-		local oldso='/lib/ld-linux.so.3'
-		local nldso='/lib/ld-linux-armhf.so.3'
-		if [[ -e ${D}${nldso} ]] ; then
-			if scanelf -qRyi "${ROOT}$(alt_prefix)"/*bin/ | grep -s "^${oldso}" ; then
-				ewarn "Symlinking old ldso (${oldso}) to new ldso (${nldso})."
-				ewarn "Please rebuild all packages using this old ldso as compat"
-				ewarn "support will be dropped in the future."
-				ln -s "${nldso##*/}" "${D}$(alt_prefix)${oldso}"
-			fi
-		fi
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-04 23:40 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-06-04 23:40 UTC (permalink / raw
  To: gentoo-commits

commit:     9a77607ea4cb5ed47bb28604661b3c17fa90f788
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  4 23:38:29 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jun  4 23:40:03 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9a77607e

sys-libs/glibc: Add keywords to glibc-2.27

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/glibc-2.27-r3.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.27-r3.ebuild b/sys-libs/glibc/glibc-2.27-r3.ebuild
index 8d6226b6119..f8a12e89714 100644
--- a/sys-libs/glibc/glibc-2.27-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r3.ebuild
@@ -18,8 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-05 17:25 Mart Raudsepp
  0 siblings, 0 replies; 1076+ messages in thread
From: Mart Raudsepp @ 2018-06-05 17:25 UTC (permalink / raw
  To: gentoo-commits

commit:     7f186fc30c1aab64740c6f8297476c8c360cda17
Author:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  5 17:15:34 2018 +0000
Commit:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
CommitDate: Tue Jun  5 17:23:07 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7f186fc3

sys-libs/glibc-2.26-r7: arm64 stable (bug #657148)

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/glibc-2.26-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index fbee4794393..a12dba0eff1 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-05 17:51 Mike Frysinger
  0 siblings, 0 replies; 1076+ messages in thread
From: Mike Frysinger @ 2018-06-05 17:51 UTC (permalink / raw
  To: gentoo-commits

commit:     d5f413abf3362ee5496bb34958a63428448946a4
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  5 17:38:20 2018 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Jun  5 17:40:19 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d5f413ab

sys-libs/glibc: mark 2.26-r7 m68k/s390/sh stable

 sys-libs/glibc/glibc-2.26-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index a12dba0eff1..856706777c2 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-06 15:25 Thomas Deutschmann
  0 siblings, 0 replies; 1076+ messages in thread
From: Thomas Deutschmann @ 2018-06-06 15:25 UTC (permalink / raw
  To: gentoo-commits

commit:     8ec9e1a292ebec94527ef796b25d5e1effcd9b86
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  6 15:22:13 2018 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Wed Jun  6 15:22:13 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8ec9e1a2

sys-libs/glibc: x86 stable (bug #657148)

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/glibc-2.26-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index 856706777c2..ac4106459e4 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-08 20:54 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-06-08 20:54 UTC (permalink / raw
  To: gentoo-commits

commit:     ba80152072965001be0eaf975d03e82130488305
Author:     Marty E. Plummer <hanetzer <AT> startmail <DOT> com>
AuthorDate: Fri Jun  1 15:17:12 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Jun  8 20:54:25 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba801520

sys-libs/glibc: git-2->git-r3

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/glibc-2.19-r1.ebuild  | 3 +--
 sys-libs/glibc/glibc-2.20-r2.ebuild  | 3 +--
 sys-libs/glibc/glibc-2.21-r2.ebuild  | 3 +--
 sys-libs/glibc/glibc-2.22-r4.ebuild  | 3 +--
 sys-libs/glibc/glibc-2.23-r4.ebuild  | 3 +--
 sys-libs/glibc/glibc-2.24-r4.ebuild  | 3 +--
 sys-libs/glibc/glibc-2.25-r11.ebuild | 3 +--
 7 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r1.ebuild b/sys-libs/glibc/glibc-2.19-r1.ebuild
index 17506c5708a..d036a728e44 100644
--- a/sys-libs/glibc/glibc-2.19-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r1.ebuild
@@ -18,8 +18,7 @@ RELEASE_VER=""
 case ${PV} in
 9999*)
 	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
+	inherit git-r3
 	;;
 *)
 	RELEASE_VER=${PV}

diff --git a/sys-libs/glibc/glibc-2.20-r2.ebuild b/sys-libs/glibc/glibc-2.20-r2.ebuild
index 2c35723c25b..c4a84ff60f6 100644
--- a/sys-libs/glibc/glibc-2.20-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.20-r2.ebuild
@@ -18,8 +18,7 @@ RELEASE_VER=""
 case ${PV} in
 9999*)
 	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
+	inherit git-r3
 	;;
 *)
 	RELEASE_VER=${PV}

diff --git a/sys-libs/glibc/glibc-2.21-r2.ebuild b/sys-libs/glibc/glibc-2.21-r2.ebuild
index 6db7c6a7883..accbd33c95a 100644
--- a/sys-libs/glibc/glibc-2.21-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.21-r2.ebuild
@@ -18,8 +18,7 @@ RELEASE_VER=""
 case ${PV} in
 9999*)
 	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
+	inherit git-r3
 	;;
 *)
 	RELEASE_VER=${PV}

diff --git a/sys-libs/glibc/glibc-2.22-r4.ebuild b/sys-libs/glibc/glibc-2.22-r4.ebuild
index 416fec87178..d6b644dd754 100644
--- a/sys-libs/glibc/glibc-2.22-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.22-r4.ebuild
@@ -18,8 +18,7 @@ RELEASE_VER=""
 case ${PV} in
 9999*)
 	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
+	inherit git-r3
 	;;
 *)
 	RELEASE_VER=${PV}

diff --git a/sys-libs/glibc/glibc-2.23-r4.ebuild b/sys-libs/glibc/glibc-2.23-r4.ebuild
index 83000a9d662..19d2ee3adaf 100644
--- a/sys-libs/glibc/glibc-2.23-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.23-r4.ebuild
@@ -18,8 +18,7 @@ RELEASE_VER=""
 case ${PV} in
 9999*)
 	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
+	inherit git-r3
 	;;
 *)
 	RELEASE_VER=${PV}

diff --git a/sys-libs/glibc/glibc-2.24-r4.ebuild b/sys-libs/glibc/glibc-2.24-r4.ebuild
index eb338ca1447..40f30a0b8eb 100644
--- a/sys-libs/glibc/glibc-2.24-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.24-r4.ebuild
@@ -18,8 +18,7 @@ RELEASE_VER=""
 case ${PV} in
 9999*)
 	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
+	inherit git-r3
 	;;
 *)
 	RELEASE_VER=${PV}

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index db95b9d9ab6..67c8f98ebb7 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -18,8 +18,7 @@ RELEASE_VER=""
 case ${PV} in
 9999*)
 	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	EGIT_SOURCEDIRS="${S}"
-	inherit git-2
+	inherit git-r3
 	;;
 *)
 	RELEASE_VER=${PV}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-13 20:46 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-06-13 20:46 UTC (permalink / raw
  To: gentoo-commits

commit:     6c3740323094626403ee2e57f4a0c5b1cb4f37bb
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 13 20:45:58 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Jun 13 20:46:38 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6c374032

sys-libs/glibc: fix -mfpu=neon build failure, bug #657760

CFLAGS=-mfpu=neon tricked glibc into not building memcpy()
implementation. It's caused by the fact that -mfpu=neon
was passed when building .c files, but was not passed
when building .S files.

This change passes CFLAGS to CPPFLAGS to apply to .S files.

Reported-by: Markus Meier
Closes: https://bugs.gentoo.org/657760
Bug: https://sourceware.org/PR23273
Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/{glibc-9999.ebuild => glibc-2.27-r4.ebuild} | 10 +++++++---
 sys-libs/glibc/glibc-9999.ebuild                           |  6 ++++++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.27-r4.ebuild
similarity index 98%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.27-r4.ebuild
index d628938b2a7..a4689e7afde 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r4.ebuild
@@ -18,8 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 
@@ -28,7 +27,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=5
+PATCH_VER=2
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
@@ -797,6 +796,11 @@ glibc_do_configure() {
 	# 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)"
 	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
+	# CFLAGS can contain ABI-spefcific flags like -mfpu=neon, see bug #657760
+	# To build .S (assembly) files with the same ABI-specific flags
+	# upstream currently recommends adding CFLAGS to CPPFLAGS: https://sourceware.org/PR23273
+	export CPPFLAGS="${CPPFLAGS} ${CFLAGS}"
+	einfo " $(printf '%15s' 'Manual CPPFLAGS:')   ${CPPFLAGS}"
 
 	echo
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index d628938b2a7..7a1ae16ce82 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -798,6 +798,12 @@ glibc_do_configure() {
 	export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS)"
 	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
 
+	# CFLAGS can contain ABI-spefcific flags like -mfpu=neon, see bug #657760
+	# To build .S (assembly) files with the same ABI-specific flags
+	# upstream currently recommends adding CFLAGS to CPPFLAGS: https://sourceware.org/PR23273
+	export CPPFLAGS="${CPPFLAGS} ${CFLAGS}"
+	einfo " $(printf '%15s' 'Manual CPPFLAGS:')   ${CPPFLAGS}"
+
 	echo
 
 	local myconf=()


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-13 22:01 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-06-13 22:01 UTC (permalink / raw
  To: gentoo-commits

commit:     2f531140d661fc965603407f7ced0af83578e22c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 13 22:01:06 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jun 13 22:01:06 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2f531140

sys-libs/glibc: Bump 9999 patchset

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index a7b01a7e57f..1fdeb21cc4a 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,4 +19,4 @@ DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
 DIST glibc-2.27-patches-2.tar.bz2 129983 BLAKE2B fad8d14f5330bc301804913f92f48051583f122cc83ab44813dc13498f59e97b38d1b276353eed9df3fde427b669cf9168632bbed8d006a3d4995c1df79575a4 SHA512 b05e34dbb45aaadfdcc079888ef2b2f70b181ba31edf2e2bbd18fa666375f5c6c48993830a305de0706b4a562db6403b6287bcab4789c1c37bc535216ee9f4cd
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
-DIST glibc-9999-patches-5.tar.bz2 15979 BLAKE2B f59b4d7096fd876c9176f6ebdd9a4a510f3c6c90dd69a1fbb092a18f296767759d8d73dc7a81e29e3f6152043a4179056d5e224896c7bb96cc09ede2e2dd16e1 SHA512 c29ad59977b2c4dfd58ee16d0898a1c16e6cde974d5c29c3a7a55e0dee4ade7f1a3d45c9481c1d35df7fcedbdb67267f5d61759cacab677b6288b5ece3871a4b
+DIST glibc-9999-patches-6.tar.bz2 15026 BLAKE2B 1db592be7c8e92a0c1e2cc88910cc3ddf39786551df14c3c99e973a2b3ea3a6f7d8afbe4f309d387121b131fde74253b00e07c2c3ffbe937be0fbf0d86ee8479 SHA512 4927a31e608bbb21f78bd2c0fbf75adee852f8b3c2ccb1f0d638b79e260628a2bf54aa7d56978f2ca8def5a3b41103d564888f42b18686d02945fa29f2a1e988

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 7a1ae16ce82..1f72a1790eb 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -28,7 +28,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=5
+PATCH_VER=6
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-15  7:02 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-06-15  7:02 UTC (permalink / raw
  To: gentoo-commits

commit:     c761267019c8c1c76779f75e8262ed7228ee315e
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 15 06:59:25 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Jun 15 07:02:23 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c7612670

sys-libs/glibc: fix typo 's/spefcific/specific/' in comment

Reported-by: Tomas Mozes
Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/glibc-2.27-r4.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.27-r4.ebuild b/sys-libs/glibc/glibc-2.27-r4.ebuild
index a4689e7afde..41fee4261d5 100644
--- a/sys-libs/glibc/glibc-2.27-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r4.ebuild
@@ -796,7 +796,7 @@ glibc_do_configure() {
 	# 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)"
 	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-	# CFLAGS can contain ABI-spefcific flags like -mfpu=neon, see bug #657760
+	# 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 CPPFLAGS: https://sourceware.org/PR23273
 	export CPPFLAGS="${CPPFLAGS} ${CFLAGS}"

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 1f72a1790eb..4b2e7331da9 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -798,7 +798,7 @@ glibc_do_configure() {
 	export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS)"
 	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
 
-	# CFLAGS can contain ABI-spefcific flags like -mfpu=neon, see bug #657760
+	# 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 CPPFLAGS: https://sourceware.org/PR23273
 	export CPPFLAGS="${CPPFLAGS} ${CFLAGS}"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-16 18:01 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-06-16 18:01 UTC (permalink / raw
  To: gentoo-commits

commit:     523c47e832c9e3a3c96643cb2d96cefec1a6da56
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 16 17:58:32 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jun 16 18:01:31 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=523c47e8

sys-libs/glibc: Ancient version doesnt build with stack protector

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/glibc-2.19-r2.ebuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index b2b9a397b55..67d94602c8f 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -367,6 +367,7 @@ setup_flags() {
 	append-flags -O2 -fno-strict-aliasing
 
 	filter-flags '-fstack-protector*'
+	append-flags '-fno-stack-protector'
 
 	# Starting with gcc-6 (and fully upstreamed pie patches) we control
 	# default enabled/disabled pie via use flags. So nothing to do


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-17 17:22 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-06-17 17:22 UTC (permalink / raw
  To: gentoo-commits

commit:     9e74c8209d768782485ad0f32ab57cf0bd21ca83
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 17 17:22:24 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Jun 17 17:22:38 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9e74c820

sys-libs/glibc: Add libidn2 dependency.

The getaddrinfo function, when called with the AI_IDN or AI_CANONIDN flags,
will use the system libidn2 library to perform IDNA encoding. Version 2.0.5
or later is recommended, otherwise there will be some failures in the glibc
test suite.

Bug: https://bugs.gentoo.org/635012
Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/glibc-9999.ebuild | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 4b2e7331da9..941eb786282 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -33,7 +33,7 @@ PATCH_VER=6
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla"
+IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd profile selinux suid systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -77,8 +77,10 @@ DEPEND="${COMMON_DEPEND}
 	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	doc? ( sys-apps/texinfo )
+	test? ( >=net-dns/libidn2-2.0.5 )
 "
 RDEPEND="${COMMON_DEPEND}
+	>=net-dns/libidn2-2.0.5
 	sys-apps/gentoo-functions
 	!sys-kernel/ps3-sources
 	!sys-libs/nss-db


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-17 17:27 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-06-17 17:27 UTC (permalink / raw
  To: gentoo-commits

commit:     271a55a9f3a4576fb8fd95762d704e6310d8819d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 17 17:27:29 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Jun 17 17:27:29 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=271a55a9

sys-libs/glibc: Require bison in DEPEND

Keeping the bug open until we've been talking to upstream
about it.

Bug: https://bugs.gentoo.org/657458
Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/glibc-2.27-r4.ebuild | 1 +
 sys-libs/glibc/glibc-9999.ebuild    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.27-r4.ebuild b/sys-libs/glibc/glibc-2.27-r4.ebuild
index 41fee4261d5..070319f2fc2 100644
--- a/sys-libs/glibc/glibc-2.27-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r4.ebuild
@@ -72,6 +72,7 @@ COMMON_DEPEND="
 "
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
 	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 941eb786282..11e503dd7aa 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -73,6 +73,7 @@ COMMON_DEPEND="
 "
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
 	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-17 17:27 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-06-17 17:27 UTC (permalink / raw
  To: gentoo-commits

commit:     b36a38e6138df53c0337d0d27eb9ccc85b930dcc
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 17 17:24:45 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Jun 17 17:24:45 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b36a38e6

sys-libs/glibc: Drop old

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/glibc-2.27-r3.ebuild | 1410 -----------------------------------
 1 file changed, 1410 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.27-r3.ebuild b/sys-libs/glibc/glibc-2.27-r3.ebuild
deleted file mode 100644
index f8a12e89714..00000000000
--- a/sys-libs/glibc/glibc-2.27-r3.ebuild
+++ /dev/null
@@ -1,1410 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=2
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	doc? ( sys-apps/texinfo )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.9
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.9
-		virtual/os-headers
-	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparc64v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparcv9v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	filter-flags '-fstack-protector*'
-
-	# Starting with gcc-6 (and fully upstreamed pie patches) we control
-	# default enabled/disabled pie via use flags. So nothing to do
-	# here then. #618160
-	if [[ $(gcc-major-version) -lt 6 ]]; then
-		if use hardened && tc-enables-pie ; then
-			# Force PIC macro definition for all compilations since they're all
-			# either -fPIC or -fPIE with the default-PIE compiler.
-			append-cppflags -DPIC
-		else
-			# Don't build -fPIE without the default-PIE compiler and the
-			# hardened-pie patch
-			filter-flags -fPIE
-		fi
-	fi
-}
-
-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}
-}
-
-use_multiarch() {
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	version_is_at_least ${nver} ${bver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if use headers-only ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	use hardened && ! tc-enables-pie && \
-		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers ; then
-		local run_kv build_kv want_kv
-
-		run_kv=$(g_get_running_KV)
-		build_kv=$(g_int_to_KV $(get_kheader_version))
-		want_kv=${MIN_KERN_VER}
-
-		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!"
-		fi
-
-		if ! is_crosscompile && ! tc-is-cross-compiler ; then
-			# Building fails on an non-supporting kernel
-			ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-			if ! eend_KV ${run_kv} ${want_kv} ; then
-				echo
-				eerror "You need a kernel of at least ${want_kv}!"
-				die "Kernel version too low!"
-			fi
-		fi
-
-		ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-		if ! eend_KV ${build_kv} ${want_kv} ; then
-			echo
-			eerror "You need linux-headers of at least ${want_kv}!"
-			die "linux-headers version too low!"
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}" || die
-	touch locale/C-translit.h || die #185476 #218003
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-
-	# The glibc configure script doesn't properly use LDFLAGS all the time.
-	export CC="$(tc-getCC ${CTARGET}) ${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)"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=all )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-		locale_list="${root}/usr/share/i18n/SUPPORTED"
-	fi
-
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		cd "${ED}"$(alt_libdir)/..
-		[[ -e lib ]] || mkdir lib
-		cd "${ED}"$(alt_usrlibdir)/..
-		[[ -e lib ]] || mkdir lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-20 21:58 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-06-20 21:58 UTC (permalink / raw
  To: gentoo-commits

commit:     a8117e71f9ae531ca4680eb8bdbf26db10d5a6cf
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 20 21:58:12 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jun 20 21:58:12 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8117e71

sys-libs/glibc: ChangeLog.old didnt exist here yet

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/glibc-2.19-r2.ebuild | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index 67d94602c8f..a398dd3650e 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -1251,7 +1251,6 @@ glibc_do_src_install() {
 	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
 		[[ -s ${d} ]] && dodoc ${d}
 	done
-	dodoc -r ChangeLog.old
 
 	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
 	# creation of the "factory" symlink in pkg_postinst().


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-23  8:24 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-06-23  8:24 UTC (permalink / raw
  To: gentoo-commits

commit:     e5866a8613615f4ef4a5eb3ced93d2d4df8e7898
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Sat Jun 23 08:09:25 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Jun 23 08:24:13 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5866a86

sys-libs/glibc: stable 2.26-r7 for sparc

Bug: https://bugs.gentoo.org/657148
Package-Manager: Portage-2.3.40, Repoman-2.3.9
RepoMan-Options: --include-arches="sparc"

 sys-libs/glibc/glibc-2.26-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index ac4106459e4..04e19e5fc4a 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh ~sparc x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-25 16:06 Tobias Klausmann
  0 siblings, 0 replies; 1076+ messages in thread
From: Tobias Klausmann @ 2018-06-25 16:06 UTC (permalink / raw
  To: gentoo-commits

commit:     c620a98f4e1112a87ee7c910bd15e5415aa967fb
Author:     Tobias Klausmann <klausman <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 25 15:57:59 2018 +0000
Commit:     Tobias Klausmann <klausman <AT> gentoo <DOT> org>
CommitDate: Mon Jun 25 16:05:55 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c620a98f

sys-libs/glibc-2.26-r7: alpha stable

Gentoo-Bug: http://bugs.gentoo.org/657148

 sys-libs/glibc/glibc-2.26-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index 04e19e5fc4a..adb85a826be 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
+	KEYWORDS="alpha amd64 ~arm arm64 ~hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-26  9:48 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-06-26  9:48 UTC (permalink / raw
  To: gentoo-commits

commit:     3ff56613857700dd0dfe2937539ae13fc3212eb4
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 26 07:54:33 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Jun 26 09:48:14 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ff56613

sys-libs/glibc: pass user's CFLAGS over CC/XX, not CPPFLAGS

Breakage example (before this change):
    # CFLAGS="-O2 -march=core2 -mno-sse4.2" emerge -v1 =glibc-2.27-r4

Here user's CFLAGS were able to override (this bug) glibc's
CFLAGS additions like:
    sysdeps/i386/i686/multiarch/Makefile:CFLAGS-strspn-c.c += -msse4

'strspn' was built as 'gcc -msse4 -mno-sse4.2' and failed:
    smmintrin.h:631:1: error: inlining failed in call to always_inline
        ‘_mm_cmpistri’: target specific option mismatch

This happens because we passed user's CFLAGS via CPPFLAGS:
   Makerules:COMPILE.c = $(CC) -c $(CFLAGS) $(CPPFLAGS)

To avoid this kind of overrides this change injects user's CFLAGS
into CC/CXX. Above example will use 'gcc -mno-sse4.2 -msse4' order.

Reported-by: Philipp Psurek
Bug: https://bugs.gentoo.org/657760
Closes: https://bugs.gentoo.org/659030
Package-Manager: Portage-2.3.40, Repoman-2.3.9

 .../{glibc-9999.ebuild => glibc-2.27-r5.ebuild}    | 26 ++++++++++------------
 sys-libs/glibc/glibc-9999.ebuild                   | 16 ++++++-------
 2 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.27-r5.ebuild
similarity index 98%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.27-r5.ebuild
index 11e503dd7aa..0e9283a66ca 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r5.ebuild
@@ -18,8 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 
@@ -28,12 +27,12 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=6
+PATCH_VER=2
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd profile selinux suid systemtap test vanilla"
+IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -78,10 +77,8 @@ DEPEND="${COMMON_DEPEND}
 	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	doc? ( sys-apps/texinfo )
-	test? ( >=net-dns/libidn2-2.0.5 )
 "
 RDEPEND="${COMMON_DEPEND}
-	>=net-dns/libidn2-2.0.5
 	sys-apps/gentoo-functions
 	!sys-kernel/ps3-sources
 	!sys-libs/nss-db
@@ -793,20 +790,21 @@ glibc_do_configure() {
 		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}) ${LDFLAGS}"
+	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)"
+	export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS) ${CFLAGS}"
 	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
 
-	# 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 CPPFLAGS: https://sourceware.org/PR23273
-	export CPPFLAGS="${CPPFLAGS} ${CFLAGS}"
-	einfo " $(printf '%15s' 'Manual CPPFLAGS:')   ${CPPFLAGS}"
-
 	echo
 
 	local myconf=()

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 11e503dd7aa..9417381e164 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -793,20 +793,20 @@ glibc_do_configure() {
 		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}) ${LDFLAGS}"
+	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)"
+	export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS) ${CFLAGS}"
 	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
 
-	# 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 CPPFLAGS: https://sourceware.org/PR23273
-	export CPPFLAGS="${CPPFLAGS} ${CFLAGS}"
-	einfo " $(printf '%15s' 'Manual CPPFLAGS:')   ${CPPFLAGS}"
-
 	echo
 
 	local myconf=()


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-06-26  9:48 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-06-26  9:48 UTC (permalink / raw
  To: gentoo-commits

commit:     d4dc260608afee733d52135f9c87325d43593b57
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 26 09:47:53 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Jun 26 09:48:15 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d4dc2606

sys-libs/glibc: add USE=multiarch (enabled by default)

Normally multiarch should be enabled (where available).
But sometimes disabling multiarch is useful:
- to workaround or validate bugs specific to selected
  runtime arch or IFUNC handling.
- to get code that matches -march= CFLAGS setting

Bug: https://bugs.gentoo.org/659030
Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/glibc-2.27-r5.ebuild | 4 +++-
 sys-libs/glibc/glibc-9999.ebuild    | 4 +++-
 sys-libs/glibc/metadata.xml         | 1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.27-r5.ebuild b/sys-libs/glibc/glibc-2.27-r5.ebuild
index 0e9283a66ca..e123d28e80d 100644
--- a/sys-libs/glibc/glibc-2.27-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r5.ebuild
@@ -32,7 +32,7 @@ PATCH_VER=2
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla"
+IUSE="audit caps compile-locales doc gd hardened headers-only +multiarch multilib nscd profile selinux suid systemtap vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -412,6 +412,8 @@ want__thread() {
 }
 
 use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
 	# Make sure binutils is new enough to support indirect functions,
 	# #336792. This funky sed supports gold and bfd linkers.
 	local bver nver

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 9417381e164..8fe8178fbb4 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -33,7 +33,7 @@ PATCH_VER=6
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd profile selinux suid systemtap test vanilla"
+IUSE="audit caps compile-locales doc gd hardened headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -415,6 +415,8 @@ want__thread() {
 }
 
 use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
 	# Make sure binutils is new enough to support indirect functions,
 	# #336792. This funky sed supports gold and bfd linkers.
 	local bver nver

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index a9538704369..89da155531e 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -9,6 +9,7 @@
  <flag name="compile-locales">build *all* locales in src_install; this is generally meant for stage building only as it ignores /etc/locale.gen file and can be pretty slow</flag>
  <flag name="debug">When USE=hardened, allow fortify/stack violations to dump core (SIGABRT) and not kill self (SIGKILL)</flag>
  <flag name="gd">build memusage and memusagestat tools</flag>
+ <flag name="multiarch">enable single DSO with optimizations for multiple architectures</flag>
  <flag name="nscd">Build, and enable support for, the Name Service Cache Daemon</flag>
  <flag name="rpc">Enable obsolete RPC/NIS layers</flag>
  <flag name="suid">Make internal pt_chown helper setuid -- not needed if using Linux and have /dev/pts mounted with gid=5</flag>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-07-02 18:27 Markus Meier
  0 siblings, 0 replies; 1076+ messages in thread
From: Markus Meier @ 2018-07-02 18:27 UTC (permalink / raw
  To: gentoo-commits

commit:     56db4f78d6e776b21ac7d889a94c09a06f8d15b2
Author:     Markus Meier <maekke <AT> gentoo <DOT> org>
AuthorDate: Mon Jul  2 18:26:35 2018 +0000
Commit:     Markus Meier <maekke <AT> gentoo <DOT> org>
CommitDate: Mon Jul  2 18:26:35 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=56db4f78

sys-libs/glibc: arm stable, bug #657148

Package-Manager: Portage-2.3.40, Repoman-2.3.9
RepoMan-Options: --include-arches="arm"

 sys-libs/glibc/glibc-2.26-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index adb85a826be..60059893929 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 ~arm arm64 ~hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-07-07 18:20 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-07-07 18:20 UTC (permalink / raw
  To: gentoo-commits

commit:     e7d904a382110a59941aab8ca905616276df7ace
Author:     Matija Skala <mskala <AT> gmx <DOT> com>
AuthorDate: Fri Jul  6 17:43:28 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Jul  7 18:19:59 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e7d904a3

sys-libs/glibc: don't check for linux version on non-linux systems

Closes: https://github.com/gentoo/gentoo/pull/9069

 sys-libs/glibc/glibc-9999.ebuild | 40 +++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 8fe8178fbb4..a0c2c4f3d45 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -684,12 +684,6 @@ sanity_prechecks() {
 
 	# When we actually have to compile something...
 	if ! just_headers ; then
-		local run_kv build_kv want_kv
-
-		run_kv=$(g_get_running_KV)
-		build_kv=$(g_int_to_KV $(get_kheader_version))
-		want_kv=${MIN_KERN_VER}
-
 		ebegin "Checking gcc for __thread support"
 		if ! eend $(want__thread ; echo $?) ; then
 			echo
@@ -698,21 +692,29 @@ sanity_prechecks() {
 			die "No __thread support in gcc!"
 		fi
 
-		if ! is_crosscompile && ! tc-is-cross-compiler ; then
-			# Building fails on an non-supporting kernel
-			ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-			if ! eend_KV ${run_kv} ${want_kv} ; then
-				echo
-				eerror "You need a kernel of at least ${want_kv}!"
-				die "Kernel version too low!"
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
 			fi
-		fi
 
-		ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-		if ! eend_KV ${build_kv} ${want_kv} ; then
-			echo
-			eerror "You need linux-headers of at least ${want_kv}!"
-			die "linux-headers version too low!"
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
 		fi
 	fi
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-07-19  0:38 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-07-19  0:38 UTC (permalink / raw
  To: gentoo-commits

commit:     88796dc3eb02643799f661d38386bede0109cef2
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 19 00:38:04 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Jul 19 00:38:24 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=88796dc3

sys-libs/glibc: preserve /usr/lib witk keepdir

Today crossdev does not install baselayout into /usr/${CTARGET}.
As a result /usr/${CTARGET}/usr/lib was not created by any ebuilds.
glibc ebuild used to create /usr/lib but recently added
install-qa-check.d/95empty-dirs by portage broke that assumption.

This change uses keepdir to ensure presense of /usr/${CTARGET}/usr/lib.
Longer term crossdev will attempt to use baselayout.

Reported-by: Vadim A. Misbakh-Soloviov <git <AT> mva.name>
Bug: https://bugs.gentoo.org/652724
Package-Manager: Portage-2.3.43, Repoman-2.3.10

 sys-libs/glibc/glibc-2.27-r5.ebuild | 6 ++----
 sys-libs/glibc/glibc-9999.ebuild    | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.27-r5.ebuild b/sys-libs/glibc/glibc-2.27-r5.ebuild
index e123d28e80d..a42e486dd6b 100644
--- a/sys-libs/glibc/glibc-2.27-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r5.ebuild
@@ -1215,10 +1215,8 @@ glibc_do_src_install() {
 		# gcc likes to use relative paths to get to its multilibs like
 		# /usr/lib/../lib64/.  So while we don't install any files into
 		# /usr/lib/, we do need it to exist.
-		cd "${ED}"$(alt_libdir)/..
-		[[ -e lib ]] || mkdir lib
-		cd "${ED}"$(alt_usrlibdir)/..
-		[[ -e lib ]] || mkdir lib
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
 
 		dosym usr/include $(alt_prefix)/sys-include
 		return 0

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a0c2c4f3d45..49b14e0284e 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1219,10 +1219,8 @@ glibc_do_src_install() {
 		# gcc likes to use relative paths to get to its multilibs like
 		# /usr/lib/../lib64/.  So while we don't install any files into
 		# /usr/lib/, we do need it to exist.
-		cd "${ED}"$(alt_libdir)/..
-		[[ -e lib ]] || mkdir lib
-		cd "${ED}"$(alt_usrlibdir)/..
-		[[ -e lib ]] || mkdir lib
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
 
 		dosym usr/include $(alt_prefix)/sys-include
 		return 0


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-08-03 17:04 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-08-03 17:04 UTC (permalink / raw
  To: gentoo-commits

commit:     3cdd2929e47d1f2d9e90d20e7273dab82c433b33
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  3 17:02:08 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Aug  3 17:04:34 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3cdd2929

sys-libs/glibc: Bump 9999 patchlevel

Package-Manager: Portage-2.3.44, Repoman-2.3.10

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 1fdeb21cc4a..9215bd834a0 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,4 +19,4 @@ DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
 DIST glibc-2.27-patches-2.tar.bz2 129983 BLAKE2B fad8d14f5330bc301804913f92f48051583f122cc83ab44813dc13498f59e97b38d1b276353eed9df3fde427b669cf9168632bbed8d006a3d4995c1df79575a4 SHA512 b05e34dbb45aaadfdcc079888ef2b2f70b181ba31edf2e2bbd18fa666375f5c6c48993830a305de0706b4a562db6403b6287bcab4789c1c37bc535216ee9f4cd
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
-DIST glibc-9999-patches-6.tar.bz2 15026 BLAKE2B 1db592be7c8e92a0c1e2cc88910cc3ddf39786551df14c3c99e973a2b3ea3a6f7d8afbe4f309d387121b131fde74253b00e07c2c3ffbe937be0fbf0d86ee8479 SHA512 4927a31e608bbb21f78bd2c0fbf75adee852f8b3c2ccb1f0d638b79e260628a2bf54aa7d56978f2ca8def5a3b41103d564888f42b18686d02945fa29f2a1e988
+DIST glibc-9999-patches-7.tar.bz2 15065 BLAKE2B 23dbe7b6dac30aedb8f563d492a2d44673c1a8233ac67b05a88fb9658b437eda8dff7ef8199d30ea07a0ef5d95b51a57c7db405ba3fdeab108b797caf6811d22 SHA512 ec2bee03969144e42849cb9923a11ac7dfe7418d8214243469227a97cd440c998d027d4d91b8e5d6c42fe5614f4c2fdfe4bfa06022e1e98efaa4150ca65387e2

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 49b14e0284e..f51a7785067 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -28,7 +28,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=6
+PATCH_VER=7
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-08-03 20:21 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-08-03 20:21 UTC (permalink / raw
  To: gentoo-commits

commit:     2695b3da15699bdf40098dd409b32f9d87a9cc5c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  3 20:19:57 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Aug  3 20:20:44 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2695b3da

sys-libs/glibc: Add rudimentary Intel CET support (since glibc-2.29)

Before unmasking this flag we still need to add checks for binutils >=2.29
and gcc >=8 ...

Package-Manager: Portage-2.3.44, Repoman-2.3.10

 sys-libs/glibc/glibc-9999.ebuild | 8 +++++++-
 sys-libs/glibc/metadata.xml      | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f51a7785067..82232b67b6d 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -33,7 +33,7 @@ PATCH_VER=7
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps compile-locales doc gd hardened headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
+IUSE="audit caps cet compile-locales doc gd hardened headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -841,6 +841,12 @@ glibc_do_configure() {
 		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
 	esac
 
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
 	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
 
 	myconf+=( --enable-kernel=${MIN_KERN_VER} )

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index 89da155531e..8079534faf1 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -14,6 +14,7 @@
  <flag name="rpc">Enable obsolete RPC/NIS layers</flag>
  <flag name="suid">Make internal pt_chown helper setuid -- not needed if using Linux and have /dev/pts mounted with gid=5</flag>
  <flag name="systemtap">enable systemtap static probe points</flag>
+ <flag name="cet">Enable Intel Control-flow Enforcement Technology (needs binutils 2.29 and gcc 8)</flag>
 </use>
 <upstream>
  <remote-id type="cpe">cpe:/a:gnu:glibc</remote-id>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-08-03 21:21 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-08-03 21:21 UTC (permalink / raw
  To: gentoo-commits

commit:     588cfbfbf10af6ed153fbcc1bda9a1d2bca02fa8
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  3 20:31:31 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Aug  3 21:20:45 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=588cfbfb

sys-libs/glibc: Needs at least GNU Make 4 to build

Package-Manager: Portage-2.3.44, Repoman-2.3.10

 sys-libs/glibc/glibc-9999.ebuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 82232b67b6d..4069c5f71ea 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -77,6 +77,7 @@ DEPEND="${COMMON_DEPEND}
 	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
 	doc? ( sys-apps/texinfo )
 	test? ( >=net-dns/libidn2-2.0.5 )
 "


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-08-03 21:21 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-08-03 21:21 UTC (permalink / raw
  To: gentoo-commits

commit:     bd032747aaf2132c00e1e008a45524de9300d742
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  3 21:20:10 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Aug  3 21:20:49 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bd032747

sys-libs/glibc: Version bump (2.28), untested, unkeyworded

Package-Manager: Portage-2.3.44, Repoman-2.3.10

 sys-libs/glibc/Manifest          |    2 +
 sys-libs/glibc/glibc-2.28.ebuild | 1429 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 1431 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 9215bd834a0..72c3b5ac244 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,4 +19,6 @@ DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
 DIST glibc-2.27-patches-2.tar.bz2 129983 BLAKE2B fad8d14f5330bc301804913f92f48051583f122cc83ab44813dc13498f59e97b38d1b276353eed9df3fde427b669cf9168632bbed8d006a3d4995c1df79575a4 SHA512 b05e34dbb45aaadfdcc079888ef2b2f70b181ba31edf2e2bbd18fa666375f5c6c48993830a305de0706b4a562db6403b6287bcab4789c1c37bc535216ee9f4cd
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
+DIST glibc-2.28-patches-1.tar.bz2 15028 BLAKE2B 4b2bcb4123a2a6d5df9c5bdf6bda29a4b7633159917d3e385bfe00d6685b71a3e42e8739a791a4ae5d88280a82227531cc6cd42536e5bd6b795f391cbcc62783 SHA512 6b9451df7a0e83e93b06ae97c564653ac17c8e0d9c78f8a0ed42750bd6e3e58938491acb018681341eb57898811dc6020fa42287e408dfd6e8189cb362e393f1
+DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-9999-patches-7.tar.bz2 15065 BLAKE2B 23dbe7b6dac30aedb8f563d492a2d44673c1a8233ac67b05a88fb9658b437eda8dff7ef8199d30ea07a0ef5d95b51a57c7db405ba3fdeab108b797caf6811d22 SHA512 ec2bee03969144e42849cb9923a11ac7dfe7418d8214243469227a97cd440c998d027d4d91b8e5d6c42fe5614f4c2fdfe4bfa06022e1e98efaa4150ca65387e2

diff --git a/sys-libs/glibc/glibc-2.28.ebuild b/sys-libs/glibc/glibc-2.28.ebuild
new file mode 100644
index 00000000000..8fa03e36304
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.28.ebuild
@@ -0,0 +1,1429 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=1
+
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales doc gd hardened headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	>=net-dns/libidn2-2.0.5
+	sys-apps/gentoo-functions
+	!sys-kernel/ps3-sources
+	!sys-libs/nss-db
+"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.9
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.9
+		virtual/os-headers
+	"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake -s glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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' 2>/dev/null ; then
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		amd64)
+			# -march needed for #185404 #199334
+			# Note: This test only matters when the x86 ABI is enabled, so we could
+			# optimize a bit and elide it.
+			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if version_is_at_least 2.8 ; then
+						cpu="sparc64v2"
+					elif version_is_at_least 2.4 ; then
+						cpu="sparc64v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if version_is_at_least 2.4 ; then
+						cpu="sparc64v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if version_is_at_least 2.8 ; then
+						cpu="sparcv9v2"
+					elif version_is_at_least 2.4 ; then
+						cpu="sparcv9v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if version_is_at_least 2.4 ; then
+						cpu="sparcv9v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Over-zealous CFLAGS can often cause problems.  What may work for one
+	# person may not work for another.  To avoid a large influx of bugs
+	# relating to failed builds, we strip most CFLAGS out to ensure as few
+	# problems as possible.
+	strip-flags
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# Lock glibc at -O2; we want to be conservative here.
+	# -fno-strict-aliasing is to work around #155906.
+	filter-flags '-O?'
+	append-flags -O2 -fno-strict-aliasing
+
+	filter-flags '-fstack-protector*'
+
+	# Starting with gcc-6 (and fully upstreamed pie patches) we control
+	# default enabled/disabled pie via use flags. So nothing to do
+	# here then. #618160
+	if [[ $(gcc-major-version) -lt 6 ]]; then
+		if use hardened && tc-enables-pie ; then
+			# Force PIC macro definition for all compilations since they're all
+			# either -fPIC or -fPIE with the default-PIE compiler.
+			append-cppflags -DPIC
+		else
+			# Don't build -fPIE without the default-PIE compiler and the
+			# hardened-pie patch
+			filter-flags -fPIE
+		fi
+	fi
+}
+
+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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	version_is_at_least ${nver} ${bver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if use headers-only ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ ${ROOT} != "/" ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ ${ROOT} == "/" ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	use hardened && ! tc-enables-pie && \
+		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${S}" || die
+	touch locale/C-translit.h || die #185476 #218003
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=all )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		--sysconfdir="${EPREFIX}/etc"
+		--localstatedir="${EPREFIX}/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="${EPREFIX}/sbin"
+	export libc_cv_slibdir="${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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local locale_list="${root}/etc/locale.gen"
+	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+		locale_list="${root}/usr/share/i18n/SUPPORTED"
+	fi
+
+	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}$(alt_prefix)" install || die
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen "${ED}"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_strip() {
+	# gdb is lame and requires some debugging information to remain in
+	# libpthread, so we need to strip it by hand.  libthread_db makes no
+	# sense stripped as it is only used when debugging.
+	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
+	env \
+		-uRESTRICT \
+		CHOST=${CTARGET} \
+		STRIP_MASK="/*/{,tls/}${pthread}*" \
+		prepallstrip
+	# if user has stripping enabled and does not have split debug turned on,
+	# then leave the debugging sections in libpthread.
+	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
+		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
+	fi
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+	src_strip
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ ${ROOT} != "/" ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+	fi
+
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		use compile-locales || run_locale_gen "${EROOT}"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-08-05  9:31 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-08-05  9:31 UTC (permalink / raw
  To: gentoo-commits

commit:     42c5a87f91540e6926cdd858ca700700a2794fea
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Aug  5 09:29:55 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Aug  5 09:30:48 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=42c5a87f

sys-libs/glibc: 2.27 revision bump (patchlevel 3)

Tests pass here

Package-Manager: Portage-2.3.44, Repoman-2.3.10

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.27-r6.ebuild | 1418 +++++++++++++++++++++++++++++++++++
 2 files changed, 1419 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 72c3b5ac244..69619572243 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,6 +18,7 @@ DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1
 DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b217391156f897a8db50f65a69627d8f8cceded78414168986ee98eba038364a6b2f3599b23f95e7b0ad2643481c399718 SHA512 0c812a343fcc68c10d92117cb2a0cf1c255470e81f0a7a04d6db2fe35445e410ef37f15162f145c2eb772b08ab55af246f5b52f5e57c2e91038181f6f027abc3
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
 DIST glibc-2.27-patches-2.tar.bz2 129983 BLAKE2B fad8d14f5330bc301804913f92f48051583f122cc83ab44813dc13498f59e97b38d1b276353eed9df3fde427b669cf9168632bbed8d006a3d4995c1df79575a4 SHA512 b05e34dbb45aaadfdcc079888ef2b2f70b181ba31edf2e2bbd18fa666375f5c6c48993830a305de0706b4a562db6403b6287bcab4789c1c37bc535216ee9f4cd
+DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07c1edb24c3edaa1e0243b846b3832a40af1ba3a7b77aef04c54a173388156b464ea442fa8310a02e6f44e2ed5b78994286 SHA512 12496e9b0c60630dbec4c2febdd6d20df1f3d7a2c243cc55b595202b27f682b9208e16cd8c387687c0cc9e18b36c3caeef8d1b1148eb3ee8081431997270db5e
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-2.28-patches-1.tar.bz2 15028 BLAKE2B 4b2bcb4123a2a6d5df9c5bdf6bda29a4b7633159917d3e385bfe00d6685b71a3e42e8739a791a4ae5d88280a82227531cc6cd42536e5bd6b795f391cbcc62783 SHA512 6b9451df7a0e83e93b06ae97c564653ac17c8e0d9c78f8a0ed42750bd6e3e58938491acb018681341eb57898811dc6020fa42287e408dfd6e8189cb362e393f1
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
new file mode 100644
index 00000000000..080b20ae25c
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -0,0 +1,1418 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=3
+
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps compile-locales doc gd hardened headers-only +multiarch multilib nscd profile selinux suid systemtap vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	!<sys-devel/bison-2.7
+	doc? ( sys-apps/texinfo )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+	!sys-kernel/ps3-sources
+	!sys-libs/nss-db
+"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.9
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.9
+		virtual/os-headers
+	"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake -s glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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' 2>/dev/null ; then
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		amd64)
+			# -march needed for #185404 #199334
+			# Note: This test only matters when the x86 ABI is enabled, so we could
+			# optimize a bit and elide it.
+			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if version_is_at_least 2.8 ; then
+						cpu="sparc64v2"
+					elif version_is_at_least 2.4 ; then
+						cpu="sparc64v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if version_is_at_least 2.4 ; then
+						cpu="sparc64v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if version_is_at_least 2.8 ; then
+						cpu="sparcv9v2"
+					elif version_is_at_least 2.4 ; then
+						cpu="sparcv9v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if version_is_at_least 2.4 ; then
+						cpu="sparcv9v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Over-zealous CFLAGS can often cause problems.  What may work for one
+	# person may not work for another.  To avoid a large influx of bugs
+	# relating to failed builds, we strip most CFLAGS out to ensure as few
+	# problems as possible.
+	strip-flags
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# Lock glibc at -O2; we want to be conservative here.
+	# -fno-strict-aliasing is to work around #155906.
+	filter-flags '-O?'
+	append-flags -O2 -fno-strict-aliasing
+
+	filter-flags '-fstack-protector*'
+
+	# Starting with gcc-6 (and fully upstreamed pie patches) we control
+	# default enabled/disabled pie via use flags. So nothing to do
+	# here then. #618160
+	if [[ $(gcc-major-version) -lt 6 ]]; then
+		if use hardened && tc-enables-pie ; then
+			# Force PIC macro definition for all compilations since they're all
+			# either -fPIC or -fPIE with the default-PIE compiler.
+			append-cppflags -DPIC
+		else
+			# Don't build -fPIE without the default-PIE compiler and the
+			# hardened-pie patch
+			filter-flags -fPIE
+		fi
+	fi
+}
+
+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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	version_is_at_least ${nver} ${bver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if use headers-only ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ ${ROOT} != "/" ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ ${ROOT} == "/" ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	use hardened && ! tc-enables-pie && \
+		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	if ! just_headers ; then
+		local run_kv build_kv want_kv
+
+		run_kv=$(g_get_running_KV)
+		build_kv=$(g_int_to_KV $(get_kheader_version))
+		want_kv=${MIN_KERN_VER}
+
+		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!"
+		fi
+
+		if ! is_crosscompile && ! tc-is-cross-compiler ; then
+			# Building fails on an non-supporting kernel
+			ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+			if ! eend_KV ${run_kv} ${want_kv} ; then
+				echo
+				eerror "You need a kernel of at least ${want_kv}!"
+				die "Kernel version too low!"
+			fi
+		fi
+
+		ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+		if ! eend_KV ${build_kv} ${want_kv} ; then
+			echo
+			eerror "You need linux-headers of at least ${want_kv}!"
+			die "linux-headers version too low!"
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${S}" || die
+	touch locale/C-translit.h || die #185476 #218003
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=all )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		--sysconfdir="${EPREFIX}/etc"
+		--localstatedir="${EPREFIX}/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="${EPREFIX}/sbin"
+	export libc_cv_slibdir="${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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local locale_list="${root}/etc/locale.gen"
+	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+		locale_list="${root}/usr/share/i18n/SUPPORTED"
+	fi
+
+	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}$(alt_prefix)" install || die
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen "${ED}"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_strip() {
+	# gdb is lame and requires some debugging information to remain in
+	# libpthread, so we need to strip it by hand.  libthread_db makes no
+	# sense stripped as it is only used when debugging.
+	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
+	env \
+		-uRESTRICT \
+		CHOST=${CTARGET} \
+		STRIP_MASK="/*/{,tls/}${pthread}*" \
+		prepallstrip
+	# if user has stripping enabled and does not have split debug turned on,
+	# then leave the debugging sections in libpthread.
+	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
+		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
+	fi
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+	src_strip
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ ${ROOT} != "/" ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+	fi
+
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		use compile-locales || run_locale_gen "${EROOT}"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-08-06  7:22 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-08-06  7:22 UTC (permalink / raw
  To: gentoo-commits

commit:     e99e5324abd5a0f115f3f626aa4c0ea05077c767
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  6 07:18:35 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Aug  6 07:21:50 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e99e5324

sys-libs/glibc: Restore keywords of 2.27-r6

Package-Manager: Portage-2.3.44, Repoman-2.3.10

 sys-libs/glibc/glibc-2.27-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 080b20ae25c..4f328fea7cb 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-08-24 15:24 Jeroen Roovers
  0 siblings, 0 replies; 1076+ messages in thread
From: Jeroen Roovers @ 2018-08-24 15:24 UTC (permalink / raw
  To: gentoo-commits

commit:     22a731fc670fd0ea9b1edb3c66620c1f2da8027f
Author:     Jeroen Roovers <jer <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 24 15:24:44 2018 +0000
Commit:     Jeroen Roovers <jer <AT> gentoo <DOT> org>
CommitDate: Fri Aug 24 15:24:44 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=22a731fc

sys-libs/glibc: Stable for HPPA too.

Package-Manager: Portage-2.3.48, Repoman-2.3.10
RepoMan-Options: --ignore-arches

 sys-libs/glibc/glibc-2.26-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index 60059893929..d309ffa8067 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-09-05 15:36 Anthony G. Basile
  0 siblings, 0 replies; 1076+ messages in thread
From: Anthony G. Basile @ 2018-09-05 15:36 UTC (permalink / raw
  To: gentoo-commits

commit:     298c315b8a2bbe9deaf4d718cd66965026523955
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Sep  5 15:36:03 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Sep  5 15:36:29 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=298c315b

sys-libs/glibc: version 2.26-r7 stable on ppc, bug #657148

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/glibc-2.26-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index d309ffa8067..23f9e11bbef 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ~ppc64 s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-09-05 19:31 Anthony G. Basile
  0 siblings, 0 replies; 1076+ messages in thread
From: Anthony G. Basile @ 2018-09-05 19:31 UTC (permalink / raw
  To: gentoo-commits

commit:     240b643b0430e17f7be8ecdf9293714a2e76eff7
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Sep  5 19:31:13 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Sep  5 19:31:13 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=240b643b

sys-libs/glibc: version 2.26-r7 stable on ppc64, bug #657148

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/glibc-2.26-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index 23f9e11bbef..f912fc41765 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ~ppc64 s390 sh sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-09-11 14:44 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-09-11 14:44 UTC (permalink / raw
  To: gentoo-commits

commit:     33ffdbefe92150236cb5588f9762b5fa7b0bdbac
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 11 14:43:03 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Sep 11 14:44:11 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=33ffdbef

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.49, Repoman-2.3.10

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.27-r4.ebuild | 1416 ----------------------------------
 sys-libs/glibc/glibc-2.27-r5.ebuild | 1418 -----------------------------------
 3 files changed, 2835 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index d42a719a158..9207dbd150e 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,7 +16,6 @@ DIST glibc-2.25-patches-15.tar.bz2 78320 BLAKE2B 70c62cc10db13e2844de4d8a18972e0
 DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
 DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b217391156f897a8db50f65a69627d8f8cceded78414168986ee98eba038364a6b2f3599b23f95e7b0ad2643481c399718 SHA512 0c812a343fcc68c10d92117cb2a0cf1c255470e81f0a7a04d6db2fe35445e410ef37f15162f145c2eb772b08ab55af246f5b52f5e57c2e91038181f6f027abc3
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
-DIST glibc-2.27-patches-2.tar.bz2 129983 BLAKE2B fad8d14f5330bc301804913f92f48051583f122cc83ab44813dc13498f59e97b38d1b276353eed9df3fde427b669cf9168632bbed8d006a3d4995c1df79575a4 SHA512 b05e34dbb45aaadfdcc079888ef2b2f70b181ba31edf2e2bbd18fa666375f5c6c48993830a305de0706b4a562db6403b6287bcab4789c1c37bc535216ee9f4cd
 DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07c1edb24c3edaa1e0243b846b3832a40af1ba3a7b77aef04c54a173388156b464ea442fa8310a02e6f44e2ed5b78994286 SHA512 12496e9b0c60630dbec4c2febdd6d20df1f3d7a2c243cc55b595202b27f682b9208e16cd8c387687c0cc9e18b36c3caeef8d1b1148eb3ee8081431997270db5e
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-2.28-patches-1.tar.bz2 15028 BLAKE2B 4b2bcb4123a2a6d5df9c5bdf6bda29a4b7633159917d3e385bfe00d6685b71a3e42e8739a791a4ae5d88280a82227531cc6cd42536e5bd6b795f391cbcc62783 SHA512 6b9451df7a0e83e93b06ae97c564653ac17c8e0d9c78f8a0ed42750bd6e3e58938491acb018681341eb57898811dc6020fa42287e408dfd6e8189cb362e393f1

diff --git a/sys-libs/glibc/glibc-2.27-r4.ebuild b/sys-libs/glibc/glibc-2.27-r4.ebuild
deleted file mode 100644
index 070319f2fc2..00000000000
--- a/sys-libs/glibc/glibc-2.27-r4.ebuild
+++ /dev/null
@@ -1,1416 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=2
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	doc? ( sys-apps/texinfo )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.9
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.9
-		virtual/os-headers
-	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparc64v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparcv9v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	filter-flags '-fstack-protector*'
-
-	# Starting with gcc-6 (and fully upstreamed pie patches) we control
-	# default enabled/disabled pie via use flags. So nothing to do
-	# here then. #618160
-	if [[ $(gcc-major-version) -lt 6 ]]; then
-		if use hardened && tc-enables-pie ; then
-			# Force PIC macro definition for all compilations since they're all
-			# either -fPIC or -fPIE with the default-PIE compiler.
-			append-cppflags -DPIC
-		else
-			# Don't build -fPIE without the default-PIE compiler and the
-			# hardened-pie patch
-			filter-flags -fPIE
-		fi
-	fi
-}
-
-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}
-}
-
-use_multiarch() {
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	version_is_at_least ${nver} ${bver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if use headers-only ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	use hardened && ! tc-enables-pie && \
-		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers ; then
-		local run_kv build_kv want_kv
-
-		run_kv=$(g_get_running_KV)
-		build_kv=$(g_int_to_KV $(get_kheader_version))
-		want_kv=${MIN_KERN_VER}
-
-		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!"
-		fi
-
-		if ! is_crosscompile && ! tc-is-cross-compiler ; then
-			# Building fails on an non-supporting kernel
-			ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-			if ! eend_KV ${run_kv} ${want_kv} ; then
-				echo
-				eerror "You need a kernel of at least ${want_kv}!"
-				die "Kernel version too low!"
-			fi
-		fi
-
-		ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-		if ! eend_KV ${build_kv} ${want_kv} ; then
-			echo
-			eerror "You need linux-headers of at least ${want_kv}!"
-			die "linux-headers version too low!"
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}" || die
-	touch locale/C-translit.h || die #185476 #218003
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-
-	# The glibc configure script doesn't properly use LDFLAGS all the time.
-	export CC="$(tc-getCC ${CTARGET}) ${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)"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-	# 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 CPPFLAGS: https://sourceware.org/PR23273
-	export CPPFLAGS="${CPPFLAGS} ${CFLAGS}"
-	einfo " $(printf '%15s' 'Manual CPPFLAGS:')   ${CPPFLAGS}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=all )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-		locale_list="${root}/usr/share/i18n/SUPPORTED"
-	fi
-
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		cd "${ED}"$(alt_libdir)/..
-		[[ -e lib ]] || mkdir lib
-		cd "${ED}"$(alt_usrlibdir)/..
-		[[ -e lib ]] || mkdir lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.27-r5.ebuild b/sys-libs/glibc/glibc-2.27-r5.ebuild
deleted file mode 100644
index a42e486dd6b..00000000000
--- a/sys-libs/glibc/glibc-2.27-r5.ebuild
+++ /dev/null
@@ -1,1418 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=2
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps compile-locales doc gd hardened headers-only +multiarch multilib nscd profile selinux suid systemtap vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	doc? ( sys-apps/texinfo )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.9
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.9
-		virtual/os-headers
-	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparc64v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparcv9v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	filter-flags '-fstack-protector*'
-
-	# Starting with gcc-6 (and fully upstreamed pie patches) we control
-	# default enabled/disabled pie via use flags. So nothing to do
-	# here then. #618160
-	if [[ $(gcc-major-version) -lt 6 ]]; then
-		if use hardened && tc-enables-pie ; then
-			# Force PIC macro definition for all compilations since they're all
-			# either -fPIC or -fPIE with the default-PIE compiler.
-			append-cppflags -DPIC
-		else
-			# Don't build -fPIE without the default-PIE compiler and the
-			# hardened-pie patch
-			filter-flags -fPIE
-		fi
-	fi
-}
-
-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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	version_is_at_least ${nver} ${bver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if use headers-only ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	use hardened && ! tc-enables-pie && \
-		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers ; then
-		local run_kv build_kv want_kv
-
-		run_kv=$(g_get_running_KV)
-		build_kv=$(g_int_to_KV $(get_kheader_version))
-		want_kv=${MIN_KERN_VER}
-
-		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!"
-		fi
-
-		if ! is_crosscompile && ! tc-is-cross-compiler ; then
-			# Building fails on an non-supporting kernel
-			ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-			if ! eend_KV ${run_kv} ${want_kv} ; then
-				echo
-				eerror "You need a kernel of at least ${want_kv}!"
-				die "Kernel version too low!"
-			fi
-		fi
-
-		ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-		if ! eend_KV ${build_kv} ${want_kv} ; then
-			echo
-			eerror "You need linux-headers of at least ${want_kv}!"
-			die "linux-headers version too low!"
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}" || die
-	touch locale/C-translit.h || die #185476 #218003
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=all )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-		locale_list="${root}/usr/share/i18n/SUPPORTED"
-	fi
-
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-09-11 14:44 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-09-11 14:44 UTC (permalink / raw
  To: gentoo-commits

commit:     a96bbde56cc77bbdc23ffbe54d4fc113f4febf98
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 11 14:39:19 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Sep 11 14:44:07 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a96bbde5

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.49, Repoman-2.3.10

 sys-libs/glibc/Manifest             |   1 -
 sys-libs/glibc/glibc-2.19-r1.ebuild | 164 ------------------------------------
 2 files changed, 165 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 69619572243..d42a719a158 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -1,6 +1,5 @@
 DIST gcc-4.7.3-r1-multilib-bootstrap.tar.bz2 8064097 BLAKE2B 3cc5c82cd57d0fbd26d9a376ee8ca02f119fe9d653311cbe4d2b7b93aec2290adac3be271be19a7fdedae2e11e4b6e32360184e557204e100ad64357f5575d4b SHA512 40b93e194ad41a75d649d84d1c49070680f253a13f0617803243bc61c44fed1ca2d0a7572a97ebb79353f312b58b5f6360be916dd7435928cc53935082e15269
 DIST gcc-multilib-bootstrap-20180511.tar.xz 2392908 BLAKE2B f3cf614399368acd8908f60d894c6344a2fa09383b30c1633a0682bc668367c8a2f8c6fec2d41b6e2178d709a2bd8db57e8b2ab56ba263c7d56f819c15acd061 SHA512 98c766e913693ab42ff790557acde2a36a8001e2648046a685b21964200df8d4d52d8452d499c0068c6648284d086ce062c2d36e2c6c2fd8aacd232d193f2853
-DIST glibc-2.19-patches-3.tar.bz2 80664 BLAKE2B fb348c711941c1bd4dadd905e172dc4f239d8b63af1a1d14dcf4ec45c504bd47e10e9b24b38f9e01796016f2e97caeeb693213ae08147274ed0a4d9501293be0 SHA512 d281d6a2757920124cf8a3f02b97e75192598b08d96ae48840df34c7ffdcb212952d171f233e6f12a429b19437d0a296212fe1f2eae164d6a1c6793cb3cb69f0
 DIST glibc-2.19-patches-9.tar.bz2 24584 BLAKE2B a96e930a5bd20fa75d9f259cc2117fa5ce98072274a24a5823bf877e3739fa4c001a94d7865e065ee0527f3974430d27da8038e042340a451ad2052c62724f26 SHA512 a95b3063ade974a3556480b798b317d33c7423a8cb9e69f67249ffb8b3d3c671d70d2d5f782c1efadc0bec4cc49a96d4fe89911f3dfcd85b459f69f3b4f38f0e
 DIST glibc-2.19.tar.xz 12083312 BLAKE2B 9dc03346e0f0df4bf009a92d894b0a9f964ff92b7f4c9663cedf1cb6cf90435f28a15539d33791ecf43ee578fa4e26f916af0367651312ef8f9c1c38ce0dafa2 SHA512 9e021fcb3afbb9ace2a0e37fded231a62de861bd766e29d47163a03182e37add718b7acc3963d1c525f9556773e842297725715acde48dcfbaab6e756af1a23d
 DIST glibc-2.20-patches-5.tar.bz2 55986 BLAKE2B bad714bd088fb8759ee84d33f22c0bba01a78a401c54828dc413c7ac2a08ae53fba9b07280996e54091f2c918658bb502aeb45f734022c1ab36e1be215381324 SHA512 409f59a028127e02f0c9f91107715b540d8d234475830adc17108a02664be232098d119b43bcc8df9b328ab50c1fffb0868d510e6487ce1c34ec2c7c7a78375b

diff --git a/sys-libs/glibc/glibc-2.19-r1.ebuild b/sys-libs/glibc/glibc-2.19-r1.ebuild
deleted file mode 100644
index d036a728e44..00000000000
--- a/sys-libs/glibc/glibc-2.19-r1.ebuild
+++ /dev/null
@@ -1,164 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=0
-
-inherit toolchain-glibc
-
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
-RESTRICT="strip" # strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-RELEASE_VER=""
-case ${PV} in
-9999*)
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	inherit git-r3
-	;;
-*)
-	RELEASE_VER=${PV}
-	;;
-esac
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-PATCH_VER="3"                                  # Gentoo patchset
-NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.16"}       # min kernel version nptl requires
-
-IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-[[ ${CTARGET} == hppa* ]] && NPTL_KERN_VER=${NPTL_KERN_VER/2.6.16/2.6.20}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-DEPEND=">=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	selinux? ( sys-libs/libselinux )"
-RDEPEND="!sys-kernel/ps3-sources
-	selinux? ( sys-libs/libselinux )
-	!sys-libs/nss-db"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.20
-		>=${CATEGORY}/gcc-4.3
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.20
-		>=sys-devel/gcc-4.3
-		virtual/os-headers
-		!vanilla? ( >=sys-libs/timezone-data-2012c )"
-	RDEPEND+="
-		vanilla? ( !sys-libs/timezone-data )
-		!vanilla? ( sys-libs/timezone-data )"
-fi
-
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
-}
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
-
-src_unpack() {
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-	toolchain-glibc_src_unpack
-
-	cd "${S}"
-
-	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
-
-	if use hardened ; then
-		einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
-		tc-enables-pie && epatch "${FILESDIR}"/2.17/glibc-2.17-hardened-pie.patch
-		epatch "${FILESDIR}"/2.19/glibc-2.19-hardened-configure-picdefault.patch
-		epatch "${FILESDIR}"/2.18/glibc-2.18-hardened-inittls-nosysenter.patch
-
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp -f "${FILESDIR}"/2.18/glibc-2.18-gentoo-stack_chk_fail.c \
-			debug/stack_chk_fail.c || die
-		cp -f "${FILESDIR}"/2.18/glibc-2.18-gentoo-chk_fail.c \
-			debug/chk_fail.c || die
-
-		if use debug ; then
-			# When using Hardened Gentoo stack handler, have smashes dump core for
-			# analysis - debug only, as core could be an information leak
-			# (paranoia).
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile \
-				|| die "Failed to modify debug/Makefile for debug stack handler"
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile \
-				|| die "Failed to modify debug/Makefile for debug fortify handler"
-		fi
-
-		# Build nscd with ssp-all
-		sed -i \
-			-e 's:-fstack-protector$:-fstack-protector-all:' \
-			nscd/Makefile \
-			|| die "Failed to ensure nscd builds with ssp-all"
-	fi
-}
-
-pkg_preinst() {
-	toolchain-glibc_pkg_preinst
-
-	if [[ ${CTARGET} == arm* ]] ; then
-		# Backwards compat support for renaming hardfp ldsos #417287
-		local oldso='/lib/ld-linux.so.3'
-		local nldso='/lib/ld-linux-armhf.so.3'
-		if [[ -e ${D}${nldso} ]] ; then
-			if scanelf -qRyi "${ROOT}$(alt_prefix)"/*bin/ | grep -s "^${oldso}" ; then
-				ewarn "Symlinking old ldso (${oldso}) to new ldso (${nldso})."
-				ewarn "Please rebuild all packages using this old ldso as compat"
-				ewarn "support will be dropped in the future."
-				ln -s "${nldso##*/}" "${D}$(alt_prefix)${oldso}"
-			fi
-		fi
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-09-11 15:43 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-09-11 15:43 UTC (permalink / raw
  To: gentoo-commits

commit:     d87aff413ebb22e1c0b092f747b6766aa64ceb25
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 11 15:42:25 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Sep 11 15:42:59 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d87aff41

sys-libs/glibc: Set 2.19 min kernel to 2.6.16 (hppa needs 2.6.20)

Closes: https://bugs.gentoo.org/664808
Package-Manager: Portage-2.3.49, Repoman-2.3.10

 sys-libs/glibc/glibc-2.19-r2.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index a398dd3650e..3ff1fb95b99 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -35,8 +35,8 @@ SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOO
 IUSE="audit caps compile-locales debug doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla"
 
 # Minimum kernel version that glibc requires
-# Everyone except hppa could also use 2.6.16
-MIN_KERN_VER="2.6.20"
+# hppa requires 2.6.20
+MIN_KERN_VER="2.6.16"
 
 # Here's how the cross-compile logic breaks down ...
 #  CTARGET - machine that will target the binaries


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-10-21  7:47 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2018-10-21  7:47 UTC (permalink / raw
  To: gentoo-commits

commit:     affd2e0bd8b1661605b556fb0756e10b2925bc0c
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 21 07:46:49 2018 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Sun Oct 21 07:46:49 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=affd2e0b

sys-libs/glibc: and64 stable wrt bug #666092

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>
Package-Manager: Portage-2.3.49, Repoman-2.3.11

 sys-libs/glibc/glibc-2.27-r6.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 4f328fea7cb..148ef32fde8 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-10-21  7:49 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2018-10-21  7:49 UTC (permalink / raw
  To: gentoo-commits

commit:     a95cdc65b150c35a0c924292adc3762dfb604f89
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 21 07:49:10 2018 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Sun Oct 21 07:49:29 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a95cdc65

sys-libs/glibc: x86 stable wrt bug #666092

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>
Package-Manager: Portage-2.3.49, Repoman-2.3.11

 sys-libs/glibc/glibc-2.27-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 148ef32fde8..b176360b42d 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-10-21 17:47 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-10-21 17:47 UTC (permalink / raw
  To: gentoo-commits

commit:     2c62d7e2b11acbd6342acf8c41fa7e6ea620774c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 21 17:00:40 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct 21 17:47:24 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2c62d7e2

sys-libs/glibc: Use .xz tarball for patches

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
Package-Manager: Portage-2.3.51, Repoman-2.3.11

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 9207dbd150e..5bf7c881790 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,4 +20,4 @@ DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-2.28-patches-1.tar.bz2 15028 BLAKE2B 4b2bcb4123a2a6d5df9c5bdf6bda29a4b7633159917d3e385bfe00d6685b71a3e42e8739a791a4ae5d88280a82227531cc6cd42536e5bd6b795f391cbcc62783 SHA512 6b9451df7a0e83e93b06ae97c564653ac17c8e0d9c78f8a0ed42750bd6e3e58938491acb018681341eb57898811dc6020fa42287e408dfd6e8189cb362e393f1
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
-DIST glibc-9999-patches-7.tar.bz2 15065 BLAKE2B 23dbe7b6dac30aedb8f563d492a2d44673c1a8233ac67b05a88fb9658b437eda8dff7ef8199d30ea07a0ef5d95b51a57c7db405ba3fdeab108b797caf6811d22 SHA512 ec2bee03969144e42849cb9923a11ac7dfe7418d8214243469227a97cd440c998d027d4d91b8e5d6c42fe5614f4c2fdfe4bfa06022e1e98efaa4150ca65387e2
+DIST glibc-9999-patches-8.tar.xz 14708 BLAKE2B 6c468f11f5b85460219f56ac694e1d3dc3de9a2a23daf7d4f2c715e1b9189bd7a5383093fd8076c2456f9ac0874cb0e2daad8fb360a62038e763a87234f95d95 SHA512 172ab4bc2e716900224b699c9ef89629ffc12756cb72fb7d9628e0ea8fc840cfb2da20ca69fa6c6e1a709f7e2a990bb0f85c32b6ace6fd2d57e2242471900e30

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 4069c5f71ea..8da63740e85 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -28,9 +28,9 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=7
+PATCH_VER=8
 
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
 IUSE="audit caps cet compile-locales doc gd hardened headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
@@ -752,7 +752,7 @@ src_unpack() {
 	touch locale/C-translit.h || die #185476 #218003
 
 	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
 }
 
 src_prepare() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-10-21 17:47 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-10-21 17:47 UTC (permalink / raw
  To: gentoo-commits

commit:     374ace5af954d580964a87b8240979fc60e35b56
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 21 17:46:27 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct 21 17:47:25 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=374ace5a

sys-libs/glibc: Revision bump, 2.28 patchset 2

The conformance tests still fail.

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
Package-Manager: Portage-2.3.51, Repoman-2.3.11

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.28-r1.ebuild | 1429 +++++++++++++++++++++++++++++++++++
 2 files changed, 1430 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 5bf7c881790..72fafb735c3 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,5 +19,6 @@ DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebf
 DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07c1edb24c3edaa1e0243b846b3832a40af1ba3a7b77aef04c54a173388156b464ea442fa8310a02e6f44e2ed5b78994286 SHA512 12496e9b0c60630dbec4c2febdd6d20df1f3d7a2c243cc55b595202b27f682b9208e16cd8c387687c0cc9e18b36c3caeef8d1b1148eb3ee8081431997270db5e
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-2.28-patches-1.tar.bz2 15028 BLAKE2B 4b2bcb4123a2a6d5df9c5bdf6bda29a4b7633159917d3e385bfe00d6685b71a3e42e8739a791a4ae5d88280a82227531cc6cd42536e5bd6b795f391cbcc62783 SHA512 6b9451df7a0e83e93b06ae97c564653ac17c8e0d9c78f8a0ed42750bd6e3e58938491acb018681341eb57898811dc6020fa42287e408dfd6e8189cb362e393f1
+DIST glibc-2.28-patches-2.tar.xz 43216 BLAKE2B e33b76d401343239ad32a1f142a214ae81a3ec3fc99ea21200255c0aee40a6b702ce98f0ffdacb2546711820ce1f51cd0782d405388bb815133739ad00c0183a SHA512 90ebfe90b79f869a8604150023aaf2d5b4de1c3d0028ebd48d803dd980efd149ced4276617a944931a2875f70918372f3a061a1f06d96f74cc96d65c117fdfef
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-9999-patches-8.tar.xz 14708 BLAKE2B 6c468f11f5b85460219f56ac694e1d3dc3de9a2a23daf7d4f2c715e1b9189bd7a5383093fd8076c2456f9ac0874cb0e2daad8fb360a62038e763a87234f95d95 SHA512 172ab4bc2e716900224b699c9ef89629ffc12756cb72fb7d9628e0ea8fc840cfb2da20ca69fa6c6e1a709f7e2a990bb0f85c32b6ace6fd2d57e2242471900e30

diff --git a/sys-libs/glibc/glibc-2.28-r1.ebuild b/sys-libs/glibc/glibc-2.28-r1.ebuild
new file mode 100644
index 00000000000..5d2d8b788b9
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.28-r1.ebuild
@@ -0,0 +1,1429 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=2
+
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales doc gd hardened headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	>=net-dns/libidn2-2.0.5
+	sys-apps/gentoo-functions
+	!sys-kernel/ps3-sources
+	!sys-libs/nss-db
+"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.9
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.9
+		virtual/os-headers
+	"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake -s glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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' 2>/dev/null ; then
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		amd64)
+			# -march needed for #185404 #199334
+			# Note: This test only matters when the x86 ABI is enabled, so we could
+			# optimize a bit and elide it.
+			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if version_is_at_least 2.8 ; then
+						cpu="sparc64v2"
+					elif version_is_at_least 2.4 ; then
+						cpu="sparc64v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if version_is_at_least 2.4 ; then
+						cpu="sparc64v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if version_is_at_least 2.8 ; then
+						cpu="sparcv9v2"
+					elif version_is_at_least 2.4 ; then
+						cpu="sparcv9v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if version_is_at_least 2.4 ; then
+						cpu="sparcv9v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Over-zealous CFLAGS can often cause problems.  What may work for one
+	# person may not work for another.  To avoid a large influx of bugs
+	# relating to failed builds, we strip most CFLAGS out to ensure as few
+	# problems as possible.
+	strip-flags
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# Lock glibc at -O2; we want to be conservative here.
+	# -fno-strict-aliasing is to work around #155906.
+	filter-flags '-O?'
+	append-flags -O2 -fno-strict-aliasing
+
+	filter-flags '-fstack-protector*'
+
+	# Starting with gcc-6 (and fully upstreamed pie patches) we control
+	# default enabled/disabled pie via use flags. So nothing to do
+	# here then. #618160
+	if [[ $(gcc-major-version) -lt 6 ]]; then
+		if use hardened && tc-enables-pie ; then
+			# Force PIC macro definition for all compilations since they're all
+			# either -fPIC or -fPIE with the default-PIE compiler.
+			append-cppflags -DPIC
+		else
+			# Don't build -fPIE without the default-PIE compiler and the
+			# hardened-pie patch
+			filter-flags -fPIE
+		fi
+	fi
+}
+
+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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	version_is_at_least ${nver} ${bver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if use headers-only ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ ${ROOT} != "/" ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ ${ROOT} == "/" ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	use hardened && ! tc-enables-pie && \
+		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${S}" || die
+	touch locale/C-translit.h || die #185476 #218003
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=all )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		--sysconfdir="${EPREFIX}/etc"
+		--localstatedir="${EPREFIX}/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="${EPREFIX}/sbin"
+	export libc_cv_slibdir="${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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local locale_list="${root}/etc/locale.gen"
+	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+		locale_list="${root}/usr/share/i18n/SUPPORTED"
+	fi
+
+	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}$(alt_prefix)" install || die
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen "${ED}"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_strip() {
+	# gdb is lame and requires some debugging information to remain in
+	# libpthread, so we need to strip it by hand.  libthread_db makes no
+	# sense stripped as it is only used when debugging.
+	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
+	env \
+		-uRESTRICT \
+		CHOST=${CTARGET} \
+		STRIP_MASK="/*/{,tls/}${pthread}*" \
+		prepallstrip
+	# if user has stripping enabled and does not have split debug turned on,
+	# then leave the debugging sections in libpthread.
+	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
+		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
+	fi
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+	src_strip
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ ${ROOT} != "/" ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+	fi
+
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		use compile-locales || run_locale_gen "${EROOT}"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-10-24 21:41 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-10-24 21:41 UTC (permalink / raw
  To: gentoo-commits

commit:     cbda286a2f7c63bf8075cb999e64c26835530c68
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 24 21:41:26 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Oct 24 21:41:39 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cbda286a

sys-libs/glibc: drop PIE ewarn

The ewarn lacks '<gcc-6' guard. Let's drop ewarn completely.

Reported-by: Alexander Tsoy
Closes: https://bugs.gentoo.org/669410
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
Package-Manager: Portage-2.3.51, Repoman-2.3.11

 sys-libs/glibc/glibc-2.19-r2.ebuild | 5 +----
 sys-libs/glibc/glibc-2.26-r7.ebuild | 5 +----
 sys-libs/glibc/glibc-2.27-r6.ebuild | 3 ---
 sys-libs/glibc/glibc-2.28-r1.ebuild | 3 ---
 sys-libs/glibc/glibc-2.28.ebuild    | 5 +----
 sys-libs/glibc/glibc-9999.ebuild    | 3 ---
 6 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index 3ff1fb95b99..496ac4d5a31 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -628,9 +628,6 @@ sanity_prechecks() {
 		ewarn "hypervisor, which is probably not what you want."
 	fi
 
-	use hardened && ! tc-enables-pie && \
-		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
-
 	# Check for sanity of /etc/nsswitch.conf
 	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
 		local entry

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index f912fc41765..75c16e8a73b 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -164,9 +164,6 @@ pkg_pretend() {
 		ewarn "hypervisor, which is probably not what you want."
 	fi
 
-	use hardened && ! tc-enables-pie && \
-		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
-
 	# Make sure host system is up to date #394453
 	if has_version '<sys-libs/glibc-2.13' && \
 	   [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]]

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index b176360b42d..fd3b74726e1 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -638,9 +638,6 @@ sanity_prechecks() {
 		ewarn "hypervisor, which is probably not what you want."
 	fi
 
-	use hardened && ! tc-enables-pie && \
-		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
-
 	# Check for sanity of /etc/nsswitch.conf
 	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
 		local entry

diff --git a/sys-libs/glibc/glibc-2.28-r1.ebuild b/sys-libs/glibc/glibc-2.28-r1.ebuild
index 5d2d8b788b9..8fe52086831 100644
--- a/sys-libs/glibc/glibc-2.28-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r1.ebuild
@@ -642,9 +642,6 @@ sanity_prechecks() {
 		ewarn "hypervisor, which is probably not what you want."
 	fi
 
-	use hardened && ! tc-enables-pie && \
-		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
-
 	# Check for sanity of /etc/nsswitch.conf
 	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
 		local entry

diff --git a/sys-libs/glibc/glibc-2.28.ebuild b/sys-libs/glibc/glibc-2.28.ebuild
index 8fa03e36304..85d8179bb38 100644
--- a/sys-libs/glibc/glibc-2.28.ebuild
+++ b/sys-libs/glibc/glibc-2.28.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -642,9 +642,6 @@ sanity_prechecks() {
 		ewarn "hypervisor, which is probably not what you want."
 	fi
 
-	use hardened && ! tc-enables-pie && \
-		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
-
 	# Check for sanity of /etc/nsswitch.conf
 	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
 		local entry

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 8da63740e85..9284afea866 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -642,9 +642,6 @@ sanity_prechecks() {
 		ewarn "hypervisor, which is probably not what you want."
 	fi
 
-	use hardened && ! tc-enables-pie && \
-		ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
-
 	# Check for sanity of /etc/nsswitch.conf
 	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
 		local entry


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-10-26 21:21 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-10-26 21:21 UTC (permalink / raw
  To: gentoo-commits

commit:     c7cc480780ac003acc7f113ac9021a1fffae6c1d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 26 21:21:32 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Oct 26 21:21:32 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c7cc4807

sys-libs/glibc: Drop old

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
Package-Manager: Portage-2.3.51, Repoman-2.3.11

 sys-libs/glibc/Manifest          |    1 -
 sys-libs/glibc/glibc-2.28.ebuild | 1426 --------------------------------------
 2 files changed, 1427 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 9c507c05c36..606e6049808 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,7 +18,6 @@ DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
 DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07c1edb24c3edaa1e0243b846b3832a40af1ba3a7b77aef04c54a173388156b464ea442fa8310a02e6f44e2ed5b78994286 SHA512 12496e9b0c60630dbec4c2febdd6d20df1f3d7a2c243cc55b595202b27f682b9208e16cd8c387687c0cc9e18b36c3caeef8d1b1148eb3ee8081431997270db5e
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
-DIST glibc-2.28-patches-1.tar.bz2 15028 BLAKE2B 4b2bcb4123a2a6d5df9c5bdf6bda29a4b7633159917d3e385bfe00d6685b71a3e42e8739a791a4ae5d88280a82227531cc6cd42536e5bd6b795f391cbcc62783 SHA512 6b9451df7a0e83e93b06ae97c564653ac17c8e0d9c78f8a0ed42750bd6e3e58938491acb018681341eb57898811dc6020fa42287e408dfd6e8189cb362e393f1
 DIST glibc-2.28-patches-2.tar.xz 43216 BLAKE2B e33b76d401343239ad32a1f142a214ae81a3ec3fc99ea21200255c0aee40a6b702ce98f0ffdacb2546711820ce1f51cd0782d405388bb815133739ad00c0183a SHA512 90ebfe90b79f869a8604150023aaf2d5b4de1c3d0028ebd48d803dd980efd149ced4276617a944931a2875f70918372f3a061a1f06d96f74cc96d65c117fdfef
 DIST glibc-2.28-patches-3.tar.xz 46172 BLAKE2B b2dc4de76ab4b4e31a6a043a133f89ede736cf3f21fb3d3091dabf282b2d70f6d017a4aec37319febb2a43c89176887a0920f2aa174fa98c66ad59cbe19ba493 SHA512 4a40a15f0e8d9ad9d33ea07addc3f07fb952bc9c110549815fb0e78cab818bc64bc8d9150874a80c249bf5765a7a2bb9b6ccfb8bc7b12f30e3807e528506cd71
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3

diff --git a/sys-libs/glibc/glibc-2.28.ebuild b/sys-libs/glibc/glibc-2.28.ebuild
deleted file mode 100644
index 85d8179bb38..00000000000
--- a/sys-libs/glibc/glibc-2.28.ebuild
+++ /dev/null
@@ -1,1426 +0,0 @@
-# Copyright 1999-2018 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=1
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales doc gd hardened headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	>=net-dns/libidn2-2.0.5
-	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.9
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.9
-		virtual/os-headers
-	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparc64v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparcv9v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	filter-flags '-fstack-protector*'
-
-	# Starting with gcc-6 (and fully upstreamed pie patches) we control
-	# default enabled/disabled pie via use flags. So nothing to do
-	# here then. #618160
-	if [[ $(gcc-major-version) -lt 6 ]]; then
-		if use hardened && tc-enables-pie ; then
-			# Force PIC macro definition for all compilations since they're all
-			# either -fPIC or -fPIE with the default-PIE compiler.
-			append-cppflags -DPIC
-		else
-			# Don't build -fPIE without the default-PIE compiler and the
-			# hardened-pie patch
-			filter-flags -fPIE
-		fi
-	fi
-}
-
-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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	version_is_at_least ${nver} ${bver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if use headers-only ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}" || die
-	touch locale/C-translit.h || die #185476 #218003
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=all )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-		locale_list="${root}/usr/share/i18n/SUPPORTED"
-	fi
-
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-10-26 21:21 Andreas Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas Hüttel @ 2018-10-26 21:21 UTC (permalink / raw
  To: gentoo-commits

commit:     b1579b77101228ea1d43993c37fa3fe3dffd7152
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 26 21:21:08 2018 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Oct 26 21:21:08 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b1579b77

sys-libs/glibc: Revision bump, 2.28 patchlevel 3

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
Package-Manager: Portage-2.3.51, Repoman-2.3.11

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.28-r2.ebuild | 1426 +++++++++++++++++++++++++++++++++++
 2 files changed, 1427 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 72fafb735c3..9c507c05c36 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,5 +20,6 @@ DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-2.28-patches-1.tar.bz2 15028 BLAKE2B 4b2bcb4123a2a6d5df9c5bdf6bda29a4b7633159917d3e385bfe00d6685b71a3e42e8739a791a4ae5d88280a82227531cc6cd42536e5bd6b795f391cbcc62783 SHA512 6b9451df7a0e83e93b06ae97c564653ac17c8e0d9c78f8a0ed42750bd6e3e58938491acb018681341eb57898811dc6020fa42287e408dfd6e8189cb362e393f1
 DIST glibc-2.28-patches-2.tar.xz 43216 BLAKE2B e33b76d401343239ad32a1f142a214ae81a3ec3fc99ea21200255c0aee40a6b702ce98f0ffdacb2546711820ce1f51cd0782d405388bb815133739ad00c0183a SHA512 90ebfe90b79f869a8604150023aaf2d5b4de1c3d0028ebd48d803dd980efd149ced4276617a944931a2875f70918372f3a061a1f06d96f74cc96d65c117fdfef
+DIST glibc-2.28-patches-3.tar.xz 46172 BLAKE2B b2dc4de76ab4b4e31a6a043a133f89ede736cf3f21fb3d3091dabf282b2d70f6d017a4aec37319febb2a43c89176887a0920f2aa174fa98c66ad59cbe19ba493 SHA512 4a40a15f0e8d9ad9d33ea07addc3f07fb952bc9c110549815fb0e78cab818bc64bc8d9150874a80c249bf5765a7a2bb9b6ccfb8bc7b12f30e3807e528506cd71
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-9999-patches-8.tar.xz 14708 BLAKE2B 6c468f11f5b85460219f56ac694e1d3dc3de9a2a23daf7d4f2c715e1b9189bd7a5383093fd8076c2456f9ac0874cb0e2daad8fb360a62038e763a87234f95d95 SHA512 172ab4bc2e716900224b699c9ef89629ffc12756cb72fb7d9628e0ea8fc840cfb2da20ca69fa6c6e1a709f7e2a990bb0f85c32b6ace6fd2d57e2242471900e30

diff --git a/sys-libs/glibc/glibc-2.28-r2.ebuild b/sys-libs/glibc/glibc-2.28-r2.ebuild
new file mode 100644
index 00000000000..f0d43996eac
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.28-r2.ebuild
@@ -0,0 +1,1426 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=3
+
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales doc gd hardened headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	>=net-dns/libidn2-2.0.5
+	sys-apps/gentoo-functions
+	!sys-kernel/ps3-sources
+	!sys-libs/nss-db
+"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-4.9
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-4.9
+		virtual/os-headers
+	"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake -s glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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' 2>/dev/null ; then
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		amd64)
+			# -march needed for #185404 #199334
+			# Note: This test only matters when the x86 ABI is enabled, so we could
+			# optimize a bit and elide it.
+			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if version_is_at_least 2.8 ; then
+						cpu="sparc64v2"
+					elif version_is_at_least 2.4 ; then
+						cpu="sparc64v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if version_is_at_least 2.4 ; then
+						cpu="sparc64v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if version_is_at_least 2.8 ; then
+						cpu="sparcv9v2"
+					elif version_is_at_least 2.4 ; then
+						cpu="sparcv9v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if version_is_at_least 2.4 ; then
+						cpu="sparcv9v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Over-zealous CFLAGS can often cause problems.  What may work for one
+	# person may not work for another.  To avoid a large influx of bugs
+	# relating to failed builds, we strip most CFLAGS out to ensure as few
+	# problems as possible.
+	strip-flags
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# Lock glibc at -O2; we want to be conservative here.
+	# -fno-strict-aliasing is to work around #155906.
+	filter-flags '-O?'
+	append-flags -O2 -fno-strict-aliasing
+
+	filter-flags '-fstack-protector*'
+
+	# Starting with gcc-6 (and fully upstreamed pie patches) we control
+	# default enabled/disabled pie via use flags. So nothing to do
+	# here then. #618160
+	if [[ $(gcc-major-version) -lt 6 ]]; then
+		if use hardened && tc-enables-pie ; then
+			# Force PIC macro definition for all compilations since they're all
+			# either -fPIC or -fPIE with the default-PIE compiler.
+			append-cppflags -DPIC
+		else
+			# Don't build -fPIE without the default-PIE compiler and the
+			# hardened-pie patch
+			filter-flags -fPIE
+		fi
+	fi
+}
+
+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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	version_is_at_least ${nver} ${bver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if use headers-only ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ ${ROOT} != "/" ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ ${ROOT} == "/" ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${S}" || die
+	touch locale/C-translit.h || die #185476 #218003
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=all )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		--sysconfdir="${EPREFIX}/etc"
+		--localstatedir="${EPREFIX}/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="${EPREFIX}/sbin"
+	export libc_cv_slibdir="${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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local locale_list="${root}/etc/locale.gen"
+	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+		locale_list="${root}/usr/share/i18n/SUPPORTED"
+	fi
+
+	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}$(alt_prefix)" install || die
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen "${ED}"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_strip() {
+	# gdb is lame and requires some debugging information to remain in
+	# libpthread, so we need to strip it by hand.  libthread_db makes no
+	# sense stripped as it is only used when debugging.
+	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
+	env \
+		-uRESTRICT \
+		CHOST=${CTARGET} \
+		STRIP_MASK="/*/{,tls/}${pthread}*" \
+		prepallstrip
+	# if user has stripping enabled and does not have split debug turned on,
+	# then leave the debugging sections in libpthread.
+	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
+		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
+	fi
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+	src_strip
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ ${ROOT} != "/" ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+	fi
+
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		use compile-locales || run_locale_gen "${EROOT}"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-10-26 22:09 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-10-26 22:09 UTC (permalink / raw
  To: gentoo-commits

commit:     5fcb4793047b346502f4f1f91391bcfc42e9deb3
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 26 22:08:54 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Oct 26 22:09:11 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5fcb4793

sys-libs/glibc: tweak USE=multiarch metadata.xml description

Stress the fact it's a feature to enable runtime implementation selection.

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
Package-Manager: Portage-2.3.51, Repoman-2.3.11

 sys-libs/glibc/metadata.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index 8079534faf1..be2851b8215 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -9,7 +9,7 @@
  <flag name="compile-locales">build *all* locales in src_install; this is generally meant for stage building only as it ignores /etc/locale.gen file and can be pretty slow</flag>
  <flag name="debug">When USE=hardened, allow fortify/stack violations to dump core (SIGABRT) and not kill self (SIGKILL)</flag>
  <flag name="gd">build memusage and memusagestat tools</flag>
- <flag name="multiarch">enable single DSO with optimizations for multiple architectures</flag>
+ <flag name="multiarch">enable optimizations for multiple CPU architectures (detected at runtime)</flag>
  <flag name="nscd">Build, and enable support for, the Name Service Cache Daemon</flag>
  <flag name="rpc">Enable obsolete RPC/NIS layers</flag>
  <flag name="suid">Make internal pt_chown helper setuid -- not needed if using Linux and have /dev/pts mounted with gid=5</flag>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-10-27 18:43 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-10-27 18:43 UTC (permalink / raw
  To: gentoo-commits

commit:     7f2b979b5efefcc814f998f7857e1127ce200ad1
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 27 18:42:28 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Oct 27 18:43:10 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7f2b979b

sys-libs/glibc: stable 2.27-r6 for ia64, bug #666092

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
Package-Manager: Portage-2.3.51, Repoman-2.3.11
RepoMan-Options: --include-arches="ia64"

 sys-libs/glibc/glibc-2.27-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index fd3b74726e1..c85ffaab89d 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-11-02  7:50 Matt Turner
  0 siblings, 0 replies; 1076+ messages in thread
From: Matt Turner @ 2018-11-02  7:50 UTC (permalink / raw
  To: gentoo-commits

commit:     2a6125dbb4b52da86e7b0f806a878663edc4f798
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  2 07:49:18 2018 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri Nov  2 07:50:35 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2a6125db

sys-libs/glibc-2.27-r6: alpha stable, bug 666092

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 sys-libs/glibc/glibc-2.27-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 005ff8e05aa..263fcba7309 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh sparc x86"
+	KEYWORDS="alpha amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-11-02 16:30 Jeroen Roovers
  0 siblings, 0 replies; 1076+ messages in thread
From: Jeroen Roovers @ 2018-11-02 16:30 UTC (permalink / raw
  To: gentoo-commits

commit:     3d1cfee39a3c92430fec47f585033af1b8fe1b71
Author:     Jeroen Roovers <jer <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  2 16:30:00 2018 +0000
Commit:     Jeroen Roovers <jer <AT> gentoo <DOT> org>
CommitDate: Fri Nov  2 16:30:42 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d1cfee3

sys-libs/glibc: Stable for HPPA too.

Package-Manager: Portage-2.3.51, Repoman-2.3.11
RepoMan-Options: --ignore-arches
Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>

 sys-libs/glibc/glibc-2.27-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 263fcba7309..9ea644eb73e 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh sparc x86"
+	KEYWORDS="alpha amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-11-09 18:15 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2018-11-09 18:15 UTC (permalink / raw
  To: gentoo-commits

commit:     34a7586c4a8dd7b861944d3cbfb0d7c4d8ce3745
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  9 18:14:58 2018 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Fri Nov  9 18:14:58 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=34a7586c

sys-libs/glibc: arm stable wrt bug #666092

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>
Package-Manager: Portage-2.3.51, Repoman-2.3.11

 sys-libs/glibc/glibc-2.27-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 9ea644eb73e..90d96f93f1a 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh sparc x86"
+	KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-11-23 23:51 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2018-11-23 23:51 UTC (permalink / raw
  To: gentoo-commits

commit:     5a205bfb45c4c238ff9d1f972beb1174bdfa2355
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 23 23:51:12 2018 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Nov 23 23:51:12 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a205bfb

sys-libs/glibc: Re-add keywords to glibc-2.28

Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.28-r2.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.28-r2.ebuild b/sys-libs/glibc/glibc-2.28-r2.ebuild
index f0d43996eac..94485cd6b08 100644
--- a/sys-libs/glibc/glibc-2.28-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r2.ebuild
@@ -18,8 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-11-23 23:51 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2018-11-23 23:51 UTC (permalink / raw
  To: gentoo-commits

commit:     cf6e6a0d029d62378baaa0283fcc2d9c7cbef6b3
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 23 23:49:03 2018 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Nov 23 23:49:03 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf6e6a0d

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.28-r1.ebuild | 1426 -----------------------------------
 2 files changed, 1427 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 606e6049808..73ee7971106 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,7 +18,6 @@ DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
 DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07c1edb24c3edaa1e0243b846b3832a40af1ba3a7b77aef04c54a173388156b464ea442fa8310a02e6f44e2ed5b78994286 SHA512 12496e9b0c60630dbec4c2febdd6d20df1f3d7a2c243cc55b595202b27f682b9208e16cd8c387687c0cc9e18b36c3caeef8d1b1148eb3ee8081431997270db5e
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
-DIST glibc-2.28-patches-2.tar.xz 43216 BLAKE2B e33b76d401343239ad32a1f142a214ae81a3ec3fc99ea21200255c0aee40a6b702ce98f0ffdacb2546711820ce1f51cd0782d405388bb815133739ad00c0183a SHA512 90ebfe90b79f869a8604150023aaf2d5b4de1c3d0028ebd48d803dd980efd149ced4276617a944931a2875f70918372f3a061a1f06d96f74cc96d65c117fdfef
 DIST glibc-2.28-patches-3.tar.xz 46172 BLAKE2B b2dc4de76ab4b4e31a6a043a133f89ede736cf3f21fb3d3091dabf282b2d70f6d017a4aec37319febb2a43c89176887a0920f2aa174fa98c66ad59cbe19ba493 SHA512 4a40a15f0e8d9ad9d33ea07addc3f07fb952bc9c110549815fb0e78cab818bc64bc8d9150874a80c249bf5765a7a2bb9b6ccfb8bc7b12f30e3807e528506cd71
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-9999-patches-8.tar.xz 14708 BLAKE2B 6c468f11f5b85460219f56ac694e1d3dc3de9a2a23daf7d4f2c715e1b9189bd7a5383093fd8076c2456f9ac0874cb0e2daad8fb360a62038e763a87234f95d95 SHA512 172ab4bc2e716900224b699c9ef89629ffc12756cb72fb7d9628e0ea8fc840cfb2da20ca69fa6c6e1a709f7e2a990bb0f85c32b6ace6fd2d57e2242471900e30

diff --git a/sys-libs/glibc/glibc-2.28-r1.ebuild b/sys-libs/glibc/glibc-2.28-r1.ebuild
deleted file mode 100644
index 8fe52086831..00000000000
--- a/sys-libs/glibc/glibc-2.28-r1.ebuild
+++ /dev/null
@@ -1,1426 +0,0 @@
-# Copyright 1999-2018 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=2
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales doc gd hardened headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	>=net-dns/libidn2-2.0.5
-	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.9
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.9
-		virtual/os-headers
-	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparc64v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparcv9v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	filter-flags '-fstack-protector*'
-
-	# Starting with gcc-6 (and fully upstreamed pie patches) we control
-	# default enabled/disabled pie via use flags. So nothing to do
-	# here then. #618160
-	if [[ $(gcc-major-version) -lt 6 ]]; then
-		if use hardened && tc-enables-pie ; then
-			# Force PIC macro definition for all compilations since they're all
-			# either -fPIC or -fPIE with the default-PIE compiler.
-			append-cppflags -DPIC
-		else
-			# Don't build -fPIE without the default-PIE compiler and the
-			# hardened-pie patch
-			filter-flags -fPIE
-		fi
-	fi
-}
-
-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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	version_is_at_least ${nver} ${bver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if use headers-only ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}" || die
-	touch locale/C-translit.h || die #185476 #218003
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=all )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-		locale_list="${root}/usr/share/i18n/SUPPORTED"
-	fi
-
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-11-24 16:00 Mart Raudsepp
  0 siblings, 0 replies; 1076+ messages in thread
From: Mart Raudsepp @ 2018-11-24 16:00 UTC (permalink / raw
  To: gentoo-commits

commit:     2ad49d19084b73aa48618a81cae6f9bfdfab770e
Author:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 24 15:46:50 2018 +0000
Commit:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
CommitDate: Sat Nov 24 15:47:13 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2ad49d19

sys-libs/glibc-2.27-r6: arm64 stable (bug #666092)

Signed-off-by: Mart Raudsepp <leio <AT> gentoo.org>
Package-Manager: Portage-2.3.49, Repoman-2.3.11

 sys-libs/glibc/glibc-2.27-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 90d96f93f1a..4b28e6e5f07 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-12-08 15:10 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2018-12-08 15:10 UTC (permalink / raw
  To: gentoo-commits

commit:     855ee4cb0dba6e6427419a186a939c94718f62e5
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Sat Dec  8 15:10:24 2018 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Sat Dec  8 15:10:34 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=855ee4cb

sys-libs/glibc: s390/sh/m68k stable wrt bug #666092

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>
Package-Manager: Portage-2.3.51, Repoman-2.3.11

 sys-libs/glibc/glibc-2.27-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 4b28e6e5f07..d39c6a02f72 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-12-08 23:45 Matt Turner
  0 siblings, 0 replies; 1076+ messages in thread
From: Matt Turner @ 2018-12-08 23:45 UTC (permalink / raw
  To: gentoo-commits

commit:     e6466f91c3bed680622a69d533b79afdd9cbce8e
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Sat Dec  8 23:44:54 2018 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Sat Dec  8 23:44:54 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e6466f91

sys-libs/glibc-2.27-r6: ppc stable, bug 666092

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 sys-libs/glibc/glibc-2.27-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index d39c6a02f72..2689b3a07fa 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ~ppc64 s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-12-08 23:45 Matt Turner
  0 siblings, 0 replies; 1076+ messages in thread
From: Matt Turner @ 2018-12-08 23:45 UTC (permalink / raw
  To: gentoo-commits

commit:     c061b5fd565564062624930d6ecc927016d3142a
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Sat Dec  8 23:44:57 2018 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Sat Dec  8 23:44:57 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c061b5fd

sys-libs/glibc-2.27-r6: ppc64 stable, bug 666092

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 sys-libs/glibc/glibc-2.27-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 2689b3a07fa..7125f84f4da 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ~ppc64 s390 sh sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-12-09 14:19 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2018-12-09 14:19 UTC (permalink / raw
  To: gentoo-commits

commit:     8348d46eb06c960586efe184bdf518095f9233f1
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Dec  9 14:18:32 2018 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Dec  9 14:18:32 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8348d46e

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |   2 -
 sys-libs/glibc/glibc-2.20-r2.ebuild | 149 ------------------------------------
 2 files changed, 151 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 73ee7971106..42c459898d3 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -2,8 +2,6 @@ DIST gcc-4.7.3-r1-multilib-bootstrap.tar.bz2 8064097 BLAKE2B 3cc5c82cd57d0fbd26d
 DIST gcc-multilib-bootstrap-20180511.tar.xz 2392908 BLAKE2B f3cf614399368acd8908f60d894c6344a2fa09383b30c1633a0682bc668367c8a2f8c6fec2d41b6e2178d709a2bd8db57e8b2ab56ba263c7d56f819c15acd061 SHA512 98c766e913693ab42ff790557acde2a36a8001e2648046a685b21964200df8d4d52d8452d499c0068c6648284d086ce062c2d36e2c6c2fd8aacd232d193f2853
 DIST glibc-2.19-patches-9.tar.bz2 24584 BLAKE2B a96e930a5bd20fa75d9f259cc2117fa5ce98072274a24a5823bf877e3739fa4c001a94d7865e065ee0527f3974430d27da8038e042340a451ad2052c62724f26 SHA512 a95b3063ade974a3556480b798b317d33c7423a8cb9e69f67249ffb8b3d3c671d70d2d5f782c1efadc0bec4cc49a96d4fe89911f3dfcd85b459f69f3b4f38f0e
 DIST glibc-2.19.tar.xz 12083312 BLAKE2B 9dc03346e0f0df4bf009a92d894b0a9f964ff92b7f4c9663cedf1cb6cf90435f28a15539d33791ecf43ee578fa4e26f916af0367651312ef8f9c1c38ce0dafa2 SHA512 9e021fcb3afbb9ace2a0e37fded231a62de861bd766e29d47163a03182e37add718b7acc3963d1c525f9556773e842297725715acde48dcfbaab6e756af1a23d
-DIST glibc-2.20-patches-5.tar.bz2 55986 BLAKE2B bad714bd088fb8759ee84d33f22c0bba01a78a401c54828dc413c7ac2a08ae53fba9b07280996e54091f2c918658bb502aeb45f734022c1ab36e1be215381324 SHA512 409f59a028127e02f0c9f91107715b540d8d234475830adc17108a02664be232098d119b43bcc8df9b328ab50c1fffb0868d510e6487ce1c34ec2c7c7a78375b
-DIST glibc-2.20.tar.xz 12283992 BLAKE2B f2db06a06e47942e9f5aaad5c4b603d63bb9a3ba624dc1c973e864d65cf893adb7568a18516c0b915b772d2ca30e95899a4d5c03ff9b3ad23e1e276a1d535f39 SHA512 7a8eea8b71d3ccba766c3f304cab61055446d451ef063309476b26dc40d880562dc33b1b68fbedeedb4b55b84c26415b9202311aaa71ef8c141b6849a814d2fa
 DIST glibc-2.21-patches-7.tar.bz2 46894 BLAKE2B 5a15a3a5ca515351d5d41baaa59ae6b6d1c353f1500c3b8dcd6da895119c89afee9ef6afaa1e7d617f2cf7b7504635e5733429f65847acaa63c0a7bf8233ee9c SHA512 e4cca3d753c0b9d213c0ed85e3d08cbbf6517862b3a48af987e010abaf5a022b47330040ced183d30b5b934de7587e97b4342e51a6df3d5cfa768bdd8b43b756
 DIST glibc-2.21.tar.xz 12322092 BLAKE2B 1ce2be09787138262b59b56235e20777459e99861c65694b96f63d7faf24da8655882dd23b39c28a8a2d338c50710f76e1e4dc39a3f4ce9736ef2cbf7f99ed5b SHA512 8cded6693618bec115f678fcbd0b77556f97dfa8337608f66e37224aefa55b38765ba61cb4d58beea37b5934e5ec8e30bad58613707388484906f2a0ce77997d
 DIST glibc-2.22-patches-13.tar.bz2 74479 BLAKE2B 1ab31614e8334508a63c842f503a395ff3ebeaa33d1890eab1d9e2985cb39064960053f2bbf99ec3bdec0ba5a80d259ca6b964fcaed9d99dcb6da84ddb8dd364 SHA512 73517fc1502b0733d67ade1d1ba6168415f5da64f37045fac0b10ef57155bf6dfbe1876e4742d2543fcea0c935c179426f6fbb94f0205968392ef903d2f83897

diff --git a/sys-libs/glibc/glibc-2.20-r2.ebuild b/sys-libs/glibc/glibc-2.20-r2.ebuild
deleted file mode 100644
index c4a84ff60f6..00000000000
--- a/sys-libs/glibc/glibc-2.20-r2.ebuild
+++ /dev/null
@@ -1,149 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="4"
-
-inherit toolchain-glibc
-
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 arm arm64 -hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
-RESTRICT="strip" # strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-RELEASE_VER=""
-case ${PV} in
-9999*)
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	inherit git-r3
-	;;
-*)
-	RELEASE_VER=${PV}
-	;;
-esac
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-PATCH_VER="5"                                  # Gentoo patchset
-: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
-
-IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-DEPEND=">=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	selinux? ( sys-libs/libselinux )"
-RDEPEND="!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	selinux? ( sys-libs/libselinux )
-	!sys-libs/nss-db"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.4
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.4
-		virtual/os-headers"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI HTTP~blueness/glibc/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
-}
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
-
-src_unpack() {
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	toolchain-glibc_src_unpack
-}
-
-src_prepare() {
-	toolchain-glibc_src_prepare
-
-	cd "${S}"
-
-	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
-
-	if use hardened ; then
-		einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
-		tc-enables-pie && epatch "${FILESDIR}"/2.17/glibc-2.17-hardened-pie.patch
-		epatch "${FILESDIR}"/2.20/glibc-2.20-hardened-inittls-nosysenter.patch
-
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-
-		# Build various bits with ssp-all
-		sed -i \
-			-e 's:-fstack-protector$:-fstack-protector-all:' \
-			*/Makefile || die
-	fi
-
-	case $(gcc-fullversion) in
-	4.8.[0-3]|4.9.0)
-		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
-		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
-		die "need to switch compilers #547420"
-		;;
-	esac
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-12-11 22:58 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2018-12-11 22:58 UTC (permalink / raw
  To: gentoo-commits

commit:     621ef8ab87d3bc72e9baf8b36c392872492e9afd
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 11 22:58:15 2018 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Dec 11 22:58:53 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=621ef8ab

sys-libs/glibc: Port to eapi7-ver. 2.28 patchlevel bump.

Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest                            |  1 +
 .../{glibc-9999.ebuild => glibc-2.28-r3.ebuild}    | 28 +++++++++++-----------
 sys-libs/glibc/glibc-9999.ebuild                   | 24 +++++++++----------
 3 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 42c459898d3..ea1782dc999 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,5 +17,6 @@ DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebf
 DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07c1edb24c3edaa1e0243b846b3832a40af1ba3a7b77aef04c54a173388156b464ea442fa8310a02e6f44e2ed5b78994286 SHA512 12496e9b0c60630dbec4c2febdd6d20df1f3d7a2c243cc55b595202b27f682b9208e16cd8c387687c0cc9e18b36c3caeef8d1b1148eb3ee8081431997270db5e
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-2.28-patches-3.tar.xz 46172 BLAKE2B b2dc4de76ab4b4e31a6a043a133f89ede736cf3f21fb3d3091dabf282b2d70f6d017a4aec37319febb2a43c89176887a0920f2aa174fa98c66ad59cbe19ba493 SHA512 4a40a15f0e8d9ad9d33ea07addc3f07fb952bc9c110549815fb0e78cab818bc64bc8d9150874a80c249bf5765a7a2bb9b6ccfb8bc7b12f30e3807e528506cd71
+DIST glibc-2.28-patches-4.tar.xz 76356 BLAKE2B b9bc6f89d2917f6a2247208ff470c33fa9010838332d9e3229ab7d912a55cb6c2ba6f8c344ed0a2df24924bab68af6b305914adda0b61301f4fc7b2e9ce76cb0 SHA512 5a088cd6b659d605c7445dfd952724533c91d59a05e1c24e505cdcdd3807b00c82ee72cc28b5b3c0a31e55e1c13c48e63779a528dd77b0ffafec62edc829a6cd
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-9999-patches-8.tar.xz 14708 BLAKE2B 6c468f11f5b85460219f56ac694e1d3dc3de9a2a23daf7d4f2c715e1b9189bd7a5383093fd8076c2456f9ac0874cb0e2daad8fb360a62038e763a87234f95d95 SHA512 172ab4bc2e716900224b699c9ef89629ffc12756cb72fb7d9628e0ea8fc840cfb2da20ca69fa6c6e1a709f7e2a990bb0f85c32b6ace6fd2d57e2242471900e30

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.28-r3.ebuild
similarity index 98%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.28-r3.ebuild
index 9284afea866..40b8b2271af 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r3.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=6
 
-inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
+inherit prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	KEYWORDS=""
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
@@ -28,7 +28,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=8
+PATCH_VER=4
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
@@ -259,18 +259,18 @@ setup_target_flags() {
 			sparc64-*)
 				case $(get-flag mcpu) in
 				niagara[234])
-					if version_is_at_least 2.8 ; then
+					if ver_test -ge 2.8 ; then
 						cpu="sparc64v2"
-					elif version_is_at_least 2.4 ; then
+					elif ver_test -ge 2.4 ; then
 						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
+					elif ver_test -ge 2.2.3 ; then
 						cpu="sparc64b"
 					fi
 					;;
 				niagara)
-					if version_is_at_least 2.4 ; then
+					if ver_test -ge 2.4 ; then
 						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
+					elif ver_test -ge 2.2.3 ; then
 						cpu="sparc64b"
 					fi
 					;;
@@ -288,20 +288,20 @@ setup_target_flags() {
 			sparc-*)
 				case $(get-flag mcpu) in
 				niagara[234])
-					if version_is_at_least 2.8 ; then
+					if ver_test -ge 2.8 ; then
 						cpu="sparcv9v2"
-					elif version_is_at_least 2.4 ; then
+					elif ver_test -ge 2.4 ; then
 						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
+					elif ver_test -ge 2.2.3 ; then
 						cpu="sparcv9b"
 					else
 						cpu="sparcv9"
 					fi
 					;;
 				niagara)
-					if version_is_at_least 2.4 ; then
+					if ver_test -ge 2.4 ; then
 						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
+					elif ver_test -ge 2.2.3 ; then
 						cpu="sparcv9b"
 					else
 						cpu="sparcv9"
@@ -433,7 +433,7 @@ use_multiarch() {
 	sparc)     nver="2.21" ;;
 	*)         return 1 ;;
 	esac
-	version_is_at_least ${nver} ${bver}
+	ver_test ${bver} -ge ${nver}
 }
 
 # Setup toolchain variables that had historically been defined in the

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 9284afea866..61685dd31e1 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=6
 
-inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
+inherit prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"
@@ -259,18 +259,18 @@ setup_target_flags() {
 			sparc64-*)
 				case $(get-flag mcpu) in
 				niagara[234])
-					if version_is_at_least 2.8 ; then
+					if ver_test -ge 2.8 ; then
 						cpu="sparc64v2"
-					elif version_is_at_least 2.4 ; then
+					elif ver_test -ge 2.4 ; then
 						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
+					elif ver_test -ge 2.2.3 ; then
 						cpu="sparc64b"
 					fi
 					;;
 				niagara)
-					if version_is_at_least 2.4 ; then
+					if ver_test -ge 2.4 ; then
 						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
+					elif ver_test -ge 2.2.3 ; then
 						cpu="sparc64b"
 					fi
 					;;
@@ -288,20 +288,20 @@ setup_target_flags() {
 			sparc-*)
 				case $(get-flag mcpu) in
 				niagara[234])
-					if version_is_at_least 2.8 ; then
+					if ver_test -ge 2.8 ; then
 						cpu="sparcv9v2"
-					elif version_is_at_least 2.4 ; then
+					elif ver_test -ge 2.4 ; then
 						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
+					elif ver_test -ge 2.2.3 ; then
 						cpu="sparcv9b"
 					else
 						cpu="sparcv9"
 					fi
 					;;
 				niagara)
-					if version_is_at_least 2.4 ; then
+					if ver_test -ge 2.4 ; then
 						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
+					elif ver_test -ge 2.2.3 ; then
 						cpu="sparcv9b"
 					else
 						cpu="sparcv9"
@@ -433,7 +433,7 @@ use_multiarch() {
 	sparc)     nver="2.21" ;;
 	*)         return 1 ;;
 	esac
-	version_is_at_least ${nver} ${bver}
+	ver_test ${bver} -ge ${nver}
 }
 
 # Setup toolchain variables that had historically been defined in the


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-12-14 19:10 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2018-12-14 19:10 UTC (permalink / raw
  To: gentoo-commits

commit:     debb1353a27e58619b9580afe685599b1682edbe
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 14 19:10:14 2018 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Dec 14 19:10:32 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=debb1353

sys-libs/glibc: Fix to locale-gen (patchlv) and ebuild for bug 673124

The -l (--list) option of locale-gen wasn't properly working.
And we needed that...

Closes: https://bugs.gentoo.org/673124
Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             | 2 +-
 sys-libs/glibc/glibc-2.28-r3.ebuild | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index ea1782dc999..6b62825c1b3 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,6 +17,6 @@ DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebf
 DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07c1edb24c3edaa1e0243b846b3832a40af1ba3a7b77aef04c54a173388156b464ea442fa8310a02e6f44e2ed5b78994286 SHA512 12496e9b0c60630dbec4c2febdd6d20df1f3d7a2c243cc55b595202b27f682b9208e16cd8c387687c0cc9e18b36c3caeef8d1b1148eb3ee8081431997270db5e
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-2.28-patches-3.tar.xz 46172 BLAKE2B b2dc4de76ab4b4e31a6a043a133f89ede736cf3f21fb3d3091dabf282b2d70f6d017a4aec37319febb2a43c89176887a0920f2aa174fa98c66ad59cbe19ba493 SHA512 4a40a15f0e8d9ad9d33ea07addc3f07fb952bc9c110549815fb0e78cab818bc64bc8d9150874a80c249bf5765a7a2bb9b6ccfb8bc7b12f30e3807e528506cd71
-DIST glibc-2.28-patches-4.tar.xz 76356 BLAKE2B b9bc6f89d2917f6a2247208ff470c33fa9010838332d9e3229ab7d912a55cb6c2ba6f8c344ed0a2df24924bab68af6b305914adda0b61301f4fc7b2e9ce76cb0 SHA512 5a088cd6b659d605c7445dfd952724533c91d59a05e1c24e505cdcdd3807b00c82ee72cc28b5b3c0a31e55e1c13c48e63779a528dd77b0ffafec62edc829a6cd
+DIST glibc-2.28-patches-5.tar.xz 76472 BLAKE2B bc3457e606ab7be2eca71c949b70f89d08418e6e2d061491dfcac3b8f962ca142f48bf0f789e025a6280f030d7bf74e3421676b08d97fc571d6e0f4e660d2758 SHA512 1639e435728a9970e4eaa79eb0a00502acecf7060d3bf70ef6bb6256ec20c23b4be6ba500a8ab97547e1af9e3df9228f7b70bb65ea1755b61c7884defa6c3535
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-9999-patches-8.tar.xz 14708 BLAKE2B 6c468f11f5b85460219f56ac694e1d3dc3de9a2a23daf7d4f2c715e1b9189bd7a5383093fd8076c2456f9ac0874cb0e2daad8fb360a62038e763a87234f95d95 SHA512 172ab4bc2e716900224b699c9ef89629ffc12756cb72fb7d9628e0ea8fc840cfb2da20ca69fa6c6e1a709f7e2a990bb0f85c32b6ace6fd2d57e2242471900e30

diff --git a/sys-libs/glibc/glibc-2.28-r3.ebuild b/sys-libs/glibc/glibc-2.28-r3.ebuild
index 40b8b2271af..34522b3ba24 100644
--- a/sys-libs/glibc/glibc-2.28-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r3.ebuild
@@ -28,7 +28,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=4
+PATCH_VER=5
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
@@ -1115,7 +1115,7 @@ run_locale_gen() {
 	# if the host locales.gen contains no entries, we'll install everything
 	local root="$1"
 	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+	if [[ $(locale-gen --list --config "${locale_list}") == "C.UTF-8" ]] ; then
 		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
 		locale_list="${root}/usr/share/i18n/SUPPORTED"
 	fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-12-14 21:23 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2018-12-14 21:23 UTC (permalink / raw
  To: gentoo-commits

commit:     afb45e0556eee1da8923610b7be9f2fa0985fc0c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 14 21:22:43 2018 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Dec 14 21:22:43 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=afb45e05

sys-libs/glibc: Rebase patchset, add C.UTF-8, fix bug 673124

Bug: https://bugs.gentoo.org/673124
Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 6b62825c1b3..fb7f9f2c0a2 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,4 +19,4 @@ DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea
 DIST glibc-2.28-patches-3.tar.xz 46172 BLAKE2B b2dc4de76ab4b4e31a6a043a133f89ede736cf3f21fb3d3091dabf282b2d70f6d017a4aec37319febb2a43c89176887a0920f2aa174fa98c66ad59cbe19ba493 SHA512 4a40a15f0e8d9ad9d33ea07addc3f07fb952bc9c110549815fb0e78cab818bc64bc8d9150874a80c249bf5765a7a2bb9b6ccfb8bc7b12f30e3807e528506cd71
 DIST glibc-2.28-patches-5.tar.xz 76472 BLAKE2B bc3457e606ab7be2eca71c949b70f89d08418e6e2d061491dfcac3b8f962ca142f48bf0f789e025a6280f030d7bf74e3421676b08d97fc571d6e0f4e660d2758 SHA512 1639e435728a9970e4eaa79eb0a00502acecf7060d3bf70ef6bb6256ec20c23b4be6ba500a8ab97547e1af9e3df9228f7b70bb65ea1755b61c7884defa6c3535
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
-DIST glibc-9999-patches-8.tar.xz 14708 BLAKE2B 6c468f11f5b85460219f56ac694e1d3dc3de9a2a23daf7d4f2c715e1b9189bd7a5383093fd8076c2456f9ac0874cb0e2daad8fb360a62038e763a87234f95d95 SHA512 172ab4bc2e716900224b699c9ef89629ffc12756cb72fb7d9628e0ea8fc840cfb2da20ca69fa6c6e1a709f7e2a990bb0f85c32b6ace6fd2d57e2242471900e30
+DIST glibc-9999-patches-9.tar.xz 17384 BLAKE2B d5ddf078a4a9e05a727ba709efdfdb5891e72d19c1a61b11bbde6a555ac38ccc4a1694d46228bbc56ff796e4e16326fb17613d73ccee8b2e6ed51a5bb371a241 SHA512 934bcb0130bd9f3a313b7107528598fb0aac27d719aded265ba111d01eac57e0235e15a4a2d2c7e0376e9d18c803c4b57f9446da4ed3e2b2a62a1587b50dcdbc

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 61685dd31e1..c7e85a20715 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -28,7 +28,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=8
+PATCH_VER=9
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
@@ -1115,7 +1115,7 @@ run_locale_gen() {
 	# if the host locales.gen contains no entries, we'll install everything
 	local root="$1"
 	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+	if [[ $(locale-gen --list --config "${locale_list}") == "C.UTF-8" ]] ; then
 		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
 		locale_list="${root}/usr/share/i18n/SUPPORTED"
 	fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-12-14 21:51 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2018-12-14 21:51 UTC (permalink / raw
  To: gentoo-commits

commit:     6f365e6c16c0ee4917c070c2fad7107b93559b5c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 14 21:51:29 2018 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Dec 14 21:51:47 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f365e6c

sys-libs/glibc: Drop old hardened support (suggested by zorry)

Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.28-r3.ebuild | 24 +++++-------------------
 sys-libs/glibc/glibc-9999.ebuild    | 24 +++++-------------------
 2 files changed, 10 insertions(+), 38 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.28-r3.ebuild b/sys-libs/glibc/glibc-2.28-r3.ebuild
index 34522b3ba24..0f66eb86043 100644
--- a/sys-libs/glibc/glibc-2.28-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r3.ebuild
@@ -33,7 +33,7 @@ PATCH_VER=5
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps cet compile-locales doc gd hardened headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
+IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -61,7 +61,8 @@ if [[ ${CTARGET} == ${CHOST} ]] ; then
 fi
 
 # We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
 COMMON_DEPEND="
 	nscd? ( selinux? (
 		audit? ( sys-process/audit )
@@ -91,13 +92,13 @@ RDEPEND="${COMMON_DEPEND}
 if [[ ${CATEGORY} == cross-* ]] ; then
 	DEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.9
+		>=${CATEGORY}/gcc-6
 	)"
 	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
 else
 	DEPEND+="
 		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.9
+		>=sys-devel/gcc-6
 		virtual/os-headers
 	"
 	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
@@ -371,21 +372,6 @@ setup_flags() {
 	append-flags -O2 -fno-strict-aliasing
 
 	filter-flags '-fstack-protector*'
-
-	# Starting with gcc-6 (and fully upstreamed pie patches) we control
-	# default enabled/disabled pie via use flags. So nothing to do
-	# here then. #618160
-	if [[ $(gcc-major-version) -lt 6 ]]; then
-		if use hardened && tc-enables-pie ; then
-			# Force PIC macro definition for all compilations since they're all
-			# either -fPIC or -fPIE with the default-PIE compiler.
-			append-cppflags -DPIC
-		else
-			# Don't build -fPIE without the default-PIE compiler and the
-			# hardened-pie patch
-			filter-flags -fPIE
-		fi
-	fi
 }
 
 want_tls() {

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index c7e85a20715..b8e90784630 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -33,7 +33,7 @@ PATCH_VER=9
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps cet compile-locales doc gd hardened headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
+IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -61,7 +61,8 @@ if [[ ${CTARGET} == ${CHOST} ]] ; then
 fi
 
 # We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
 COMMON_DEPEND="
 	nscd? ( selinux? (
 		audit? ( sys-process/audit )
@@ -91,13 +92,13 @@ RDEPEND="${COMMON_DEPEND}
 if [[ ${CATEGORY} == cross-* ]] ; then
 	DEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.9
+		>=${CATEGORY}/gcc-6
 	)"
 	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
 else
 	DEPEND+="
 		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.9
+		>=sys-devel/gcc-6
 		virtual/os-headers
 	"
 	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
@@ -371,21 +372,6 @@ setup_flags() {
 	append-flags -O2 -fno-strict-aliasing
 
 	filter-flags '-fstack-protector*'
-
-	# Starting with gcc-6 (and fully upstreamed pie patches) we control
-	# default enabled/disabled pie via use flags. So nothing to do
-	# here then. #618160
-	if [[ $(gcc-major-version) -lt 6 ]]; then
-		if use hardened && tc-enables-pie ; then
-			# Force PIC macro definition for all compilations since they're all
-			# either -fPIC or -fPIE with the default-PIE compiler.
-			append-cppflags -DPIC
-		else
-			# Don't build -fPIE without the default-PIE compiler and the
-			# hardened-pie patch
-			filter-flags -fPIE
-		fi
-	fi
 }
 
 want_tls() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-12-15 12:28 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2018-12-15 12:28 UTC (permalink / raw
  To: gentoo-commits

commit:     d7719fe914945afeee9c1e055397efeee2cdb27e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 15 12:28:15 2018 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Dec 15 12:28:34 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d7719fe9

sys-libs/glibc: Re-keyword 2.28-r3

This revision bump adds the locale C.UTF-8, which is always generated.

Closes: https://bugs.gentoo.org/671024
Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.28-r3.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.28-r3.ebuild b/sys-libs/glibc/glibc-2.28-r3.ebuild
index 0f66eb86043..4f0bb6b191f 100644
--- a/sys-libs/glibc/glibc-2.28-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r3.ebuild
@@ -18,8 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-12-21 15:37 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2018-12-21 15:37 UTC (permalink / raw
  To: gentoo-commits

commit:     fb5ac083cc33d3061f6bf86e484da6231d566981
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 21 15:36:41 2018 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Dec 21 15:37:16 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fb5ac083

sys-libs/glibc: Revision bump, 2.28 patchlevel 6

* More upstream patches from release branch
* locale-gen: precisely replicate previous (2.27) behaviour
  (no locales defined in config file -> ebuild builds all locales,
   manual call stops with warning and keeps locale archive)

Bug: https://bugs.gentoo.org/673124
Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.28-r4.ebuild | 1412 +++++++++++++++++++++++++++++++++++
 2 files changed, 1413 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index fb7f9f2c0a2..bbf500d820e 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,5 +18,6 @@ DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-2.28-patches-3.tar.xz 46172 BLAKE2B b2dc4de76ab4b4e31a6a043a133f89ede736cf3f21fb3d3091dabf282b2d70f6d017a4aec37319febb2a43c89176887a0920f2aa174fa98c66ad59cbe19ba493 SHA512 4a40a15f0e8d9ad9d33ea07addc3f07fb952bc9c110549815fb0e78cab818bc64bc8d9150874a80c249bf5765a7a2bb9b6ccfb8bc7b12f30e3807e528506cd71
 DIST glibc-2.28-patches-5.tar.xz 76472 BLAKE2B bc3457e606ab7be2eca71c949b70f89d08418e6e2d061491dfcac3b8f962ca142f48bf0f789e025a6280f030d7bf74e3421676b08d97fc571d6e0f4e660d2758 SHA512 1639e435728a9970e4eaa79eb0a00502acecf7060d3bf70ef6bb6256ec20c23b4be6ba500a8ab97547e1af9e3df9228f7b70bb65ea1755b61c7884defa6c3535
+DIST glibc-2.28-patches-6.tar.xz 89724 BLAKE2B f846534dc912f11ed9b22badfd28ef0402451654390756d2f6332f52ce7c2d3491ed90bbdf2553d7bb38caea6373ad2d3c19e4a1f31f3669948f4e2cbaeb1577 SHA512 f687febde875bb8adb7a61408caea3db99bbbda703eb3486c7d5c09540515e657eda406bf14686498e2c093355c72395502a343201e02cfc97adf6483d8e7455
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-9999-patches-9.tar.xz 17384 BLAKE2B d5ddf078a4a9e05a727ba709efdfdb5891e72d19c1a61b11bbde6a555ac38ccc4a1694d46228bbc56ff796e4e16326fb17613d73ccee8b2e6ed51a5bb371a241 SHA512 934bcb0130bd9f3a313b7107528598fb0aac27d719aded265ba111d01eac57e0235e15a4a2d2c7e0376e9d18c803c4b57f9446da4ed3e2b2a62a1587b50dcdbc

diff --git a/sys-libs/glibc/glibc-2.28-r4.ebuild b/sys-libs/glibc/glibc-2.28-r4.ebuild
new file mode 100644
index 00000000000..afd0ba6ff7e
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.28-r4.ebuild
@@ -0,0 +1,1412 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=6
+
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	>=net-dns/libidn2-2.0.5
+	sys-apps/gentoo-functions
+	!sys-kernel/ps3-sources
+	!sys-libs/nss-db
+"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+		virtual/os-headers
+	"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake -s glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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' 2>/dev/null ; then
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		amd64)
+			# -march needed for #185404 #199334
+			# Note: This test only matters when the x86 ABI is enabled, so we could
+			# optimize a bit and elide it.
+			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparc64v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparcv9v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Over-zealous CFLAGS can often cause problems.  What may work for one
+	# person may not work for another.  To avoid a large influx of bugs
+	# relating to failed builds, we strip most CFLAGS out to ensure as few
+	# problems as possible.
+	strip-flags
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# Lock glibc at -O2; we want to be conservative here.
+	# -fno-strict-aliasing is to work around #155906.
+	filter-flags '-O?'
+	append-flags -O2 -fno-strict-aliasing
+
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if use headers-only ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ ${ROOT} != "/" ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ ${ROOT} == "/" ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${S}" || die
+	touch locale/C-translit.h || die #185476 #218003
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=all )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		--sysconfdir="${EPREFIX}/etc"
+		--localstatedir="${EPREFIX}/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="${EPREFIX}/sbin"
+	export libc_cv_slibdir="${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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local locale_list="${root}/etc/locale.gen"
+	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+		locale_list="${root}/usr/share/i18n/SUPPORTED"
+	fi
+
+	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}$(alt_prefix)" install || die
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen "${ED}"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_strip() {
+	# gdb is lame and requires some debugging information to remain in
+	# libpthread, so we need to strip it by hand.  libthread_db makes no
+	# sense stripped as it is only used when debugging.
+	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
+	env \
+		-uRESTRICT \
+		CHOST=${CTARGET} \
+		STRIP_MASK="/*/{,tls/}${pthread}*" \
+		prepallstrip
+	# if user has stripping enabled and does not have split debug turned on,
+	# then leave the debugging sections in libpthread.
+	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
+		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
+	fi
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+	src_strip
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ ${ROOT} != "/" ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+	fi
+
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		use compile-locales || run_locale_gen "${EROOT}"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-12-21 16:21 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2018-12-21 16:21 UTC (permalink / raw
  To: gentoo-commits

commit:     481e2e89a13668daaa3e14e3310faf3e9e87d62e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 21 16:21:18 2018 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Dec 21 16:21:34 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=481e2e89

sys-libs/glibc: locale-gen: precisely replicate 2.27 behaviour

Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index bbf500d820e..4483254573b 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,4 +20,4 @@ DIST glibc-2.28-patches-3.tar.xz 46172 BLAKE2B b2dc4de76ab4b4e31a6a043a133f89ede
 DIST glibc-2.28-patches-5.tar.xz 76472 BLAKE2B bc3457e606ab7be2eca71c949b70f89d08418e6e2d061491dfcac3b8f962ca142f48bf0f789e025a6280f030d7bf74e3421676b08d97fc571d6e0f4e660d2758 SHA512 1639e435728a9970e4eaa79eb0a00502acecf7060d3bf70ef6bb6256ec20c23b4be6ba500a8ab97547e1af9e3df9228f7b70bb65ea1755b61c7884defa6c3535
 DIST glibc-2.28-patches-6.tar.xz 89724 BLAKE2B f846534dc912f11ed9b22badfd28ef0402451654390756d2f6332f52ce7c2d3491ed90bbdf2553d7bb38caea6373ad2d3c19e4a1f31f3669948f4e2cbaeb1577 SHA512 f687febde875bb8adb7a61408caea3db99bbbda703eb3486c7d5c09540515e657eda406bf14686498e2c093355c72395502a343201e02cfc97adf6483d8e7455
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
-DIST glibc-9999-patches-9.tar.xz 17384 BLAKE2B d5ddf078a4a9e05a727ba709efdfdb5891e72d19c1a61b11bbde6a555ac38ccc4a1694d46228bbc56ff796e4e16326fb17613d73ccee8b2e6ed51a5bb371a241 SHA512 934bcb0130bd9f3a313b7107528598fb0aac27d719aded265ba111d01eac57e0235e15a4a2d2c7e0376e9d18c803c4b57f9446da4ed3e2b2a62a1587b50dcdbc
+DIST glibc-9999-patches-10.tar.xz 17544 BLAKE2B 1cd4fa14b2168e371c769c06a29f36d6dbd3beccb796788470b63282cb8e5c3c497e4eb3800e4bc86c07d3b82935d71dc96dc3155178d52b68873ea38a271a70 SHA512 bbd376ad87fb71de7a6a4eb28030aa1550f7cca57e521d2a326cab63a66e2dc784b93319190f8bb1b24b335acc604d0523c3ea8335a4424373796ebeb79f273b

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index b8e90784630..46dde2c6ce3 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	KEYWORDS=""
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
@@ -28,7 +28,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=9
+PATCH_VER=10
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
@@ -1101,7 +1101,7 @@ run_locale_gen() {
 	# if the host locales.gen contains no entries, we'll install everything
 	local root="$1"
 	local locale_list="${root}/etc/locale.gen"
-	if [[ $(locale-gen --list --config "${locale_list}") == "C.UTF-8" ]] ; then
+	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
 		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
 		locale_list="${root}/usr/share/i18n/SUPPORTED"
 	fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-12-21 23:55 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2018-12-21 23:55 UTC (permalink / raw
  To: gentoo-commits

commit:     856446d92fe4e5228366c81b46f45244db58bf7f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 21 23:54:37 2018 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Dec 21 23:54:37 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=856446d9

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.28-r2.ebuild | 1425 -----------------------------------
 2 files changed, 1426 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 4483254573b..e1284284791 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,7 +16,6 @@ DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
 DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07c1edb24c3edaa1e0243b846b3832a40af1ba3a7b77aef04c54a173388156b464ea442fa8310a02e6f44e2ed5b78994286 SHA512 12496e9b0c60630dbec4c2febdd6d20df1f3d7a2c243cc55b595202b27f682b9208e16cd8c387687c0cc9e18b36c3caeef8d1b1148eb3ee8081431997270db5e
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
-DIST glibc-2.28-patches-3.tar.xz 46172 BLAKE2B b2dc4de76ab4b4e31a6a043a133f89ede736cf3f21fb3d3091dabf282b2d70f6d017a4aec37319febb2a43c89176887a0920f2aa174fa98c66ad59cbe19ba493 SHA512 4a40a15f0e8d9ad9d33ea07addc3f07fb952bc9c110549815fb0e78cab818bc64bc8d9150874a80c249bf5765a7a2bb9b6ccfb8bc7b12f30e3807e528506cd71
 DIST glibc-2.28-patches-5.tar.xz 76472 BLAKE2B bc3457e606ab7be2eca71c949b70f89d08418e6e2d061491dfcac3b8f962ca142f48bf0f789e025a6280f030d7bf74e3421676b08d97fc571d6e0f4e660d2758 SHA512 1639e435728a9970e4eaa79eb0a00502acecf7060d3bf70ef6bb6256ec20c23b4be6ba500a8ab97547e1af9e3df9228f7b70bb65ea1755b61c7884defa6c3535
 DIST glibc-2.28-patches-6.tar.xz 89724 BLAKE2B f846534dc912f11ed9b22badfd28ef0402451654390756d2f6332f52ce7c2d3491ed90bbdf2553d7bb38caea6373ad2d3c19e4a1f31f3669948f4e2cbaeb1577 SHA512 f687febde875bb8adb7a61408caea3db99bbbda703eb3486c7d5c09540515e657eda406bf14686498e2c093355c72395502a343201e02cfc97adf6483d8e7455
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3

diff --git a/sys-libs/glibc/glibc-2.28-r2.ebuild b/sys-libs/glibc/glibc-2.28-r2.ebuild
deleted file mode 100644
index 94485cd6b08..00000000000
--- a/sys-libs/glibc/glibc-2.28-r2.ebuild
+++ /dev/null
@@ -1,1425 +0,0 @@
-# Copyright 1999-2018 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=3
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales doc gd hardened headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	>=net-dns/libidn2-2.0.5
-	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.9
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.9
-		virtual/os-headers
-	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparc64v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparcv9v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	filter-flags '-fstack-protector*'
-
-	# Starting with gcc-6 (and fully upstreamed pie patches) we control
-	# default enabled/disabled pie via use flags. So nothing to do
-	# here then. #618160
-	if [[ $(gcc-major-version) -lt 6 ]]; then
-		if use hardened && tc-enables-pie ; then
-			# Force PIC macro definition for all compilations since they're all
-			# either -fPIC or -fPIE with the default-PIE compiler.
-			append-cppflags -DPIC
-		else
-			# Don't build -fPIE without the default-PIE compiler and the
-			# hardened-pie patch
-			filter-flags -fPIE
-		fi
-	fi
-}
-
-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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	version_is_at_least ${nver} ${bver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if use headers-only ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}" || die
-	touch locale/C-translit.h || die #185476 #218003
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=all )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-		locale_list="${root}/usr/share/i18n/SUPPORTED"
-	fi
-
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-12-21 23:55 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2018-12-21 23:55 UTC (permalink / raw
  To: gentoo-commits

commit:     e727adc20643f14e3b4a5003d036f092068f2e06
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 21 23:53:45 2018 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Dec 21 23:53:45 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e727adc2

sys-libs/glibc: Re-keyword 2.28-r4

Two test failures on ~amd64:
FAIL: nptl/tst-tss-basic
FAIL: resolv/tst-resolv-ai_idn-nolibidn2

Bug: https://bugs.gentoo.org/673124
Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.28-r4.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.28-r4.ebuild b/sys-libs/glibc/glibc-2.28-r4.ebuild
index afd0ba6ff7e..bbe2505ad88 100644
--- a/sys-libs/glibc/glibc-2.28-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r4.ebuild
@@ -18,8 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-12-29 22:13 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2018-12-29 22:13 UTC (permalink / raw
  To: gentoo-commits

commit:     ef46c8f88fadaa8dc55295e9cc748fc574eeba03
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 29 22:12:53 2018 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Dec 29 22:13:20 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ef46c8f8

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.53, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.28-r3.ebuild | 1411 -----------------------------------
 2 files changed, 1412 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index e1284284791..69b5d1d0d38 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,7 +16,6 @@ DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
 DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07c1edb24c3edaa1e0243b846b3832a40af1ba3a7b77aef04c54a173388156b464ea442fa8310a02e6f44e2ed5b78994286 SHA512 12496e9b0c60630dbec4c2febdd6d20df1f3d7a2c243cc55b595202b27f682b9208e16cd8c387687c0cc9e18b36c3caeef8d1b1148eb3ee8081431997270db5e
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
-DIST glibc-2.28-patches-5.tar.xz 76472 BLAKE2B bc3457e606ab7be2eca71c949b70f89d08418e6e2d061491dfcac3b8f962ca142f48bf0f789e025a6280f030d7bf74e3421676b08d97fc571d6e0f4e660d2758 SHA512 1639e435728a9970e4eaa79eb0a00502acecf7060d3bf70ef6bb6256ec20c23b4be6ba500a8ab97547e1af9e3df9228f7b70bb65ea1755b61c7884defa6c3535
 DIST glibc-2.28-patches-6.tar.xz 89724 BLAKE2B f846534dc912f11ed9b22badfd28ef0402451654390756d2f6332f52ce7c2d3491ed90bbdf2553d7bb38caea6373ad2d3c19e4a1f31f3669948f4e2cbaeb1577 SHA512 f687febde875bb8adb7a61408caea3db99bbbda703eb3486c7d5c09540515e657eda406bf14686498e2c093355c72395502a343201e02cfc97adf6483d8e7455
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-9999-patches-10.tar.xz 17544 BLAKE2B 1cd4fa14b2168e371c769c06a29f36d6dbd3beccb796788470b63282cb8e5c3c497e4eb3800e4bc86c07d3b82935d71dc96dc3155178d52b68873ea38a271a70 SHA512 bbd376ad87fb71de7a6a4eb28030aa1550f7cca57e521d2a326cab63a66e2dc784b93319190f8bb1b24b335acc604d0523c3ea8335a4424373796ebeb79f273b

diff --git a/sys-libs/glibc/glibc-2.28-r3.ebuild b/sys-libs/glibc/glibc-2.28-r3.ebuild
deleted file mode 100644
index 4f0bb6b191f..00000000000
--- a/sys-libs/glibc/glibc-2.28-r3.ebuild
+++ /dev/null
@@ -1,1411 +0,0 @@
-# Copyright 1999-2018 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=5
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	>=net-dns/libidn2-2.0.5
-	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-		virtual/os-headers
-	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if use headers-only ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}" || die
-	touch locale/C-translit.h || die #185476 #218003
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=all )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
-	if [[ $(locale-gen --list --config "${locale_list}") == "C.UTF-8" ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-		locale_list="${root}/usr/share/i18n/SUPPORTED"
-	fi
-
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2018-12-30 21:14 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2018-12-30 21:14 UTC (permalink / raw
  To: gentoo-commits

commit:     1c21dcc94ef9d60d9a655275dc0cf989ae8980ac
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 30 21:09:50 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Dec 30 21:14:07 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1c21dcc9

sys-libs/glibc: fix live ebuild build failure, bug #674080

Fix by Bart Oldeman:

Stop touching C-translit.h, as it's now always automatically generated in the
build directory. Touching it creates a 0-byte file that causes missing symbols
when it's included instead of the generated file.

See here for the glibc change:
https://sourceware.org/git/?p=glibc.git;a=commit;h=053c52b17739a584ee73d336e547b15abcdabd49

Closes: https://bugs.gentoo.org/674080
Signed-off-by: Bart Oldeman <bartoldeman <AT> gmail.com>
Package-Manager: Portage-2.3.53, Repoman-2.3.12
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 46dde2c6ce3..ea9f2ab2563 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -731,9 +731,6 @@ src_unpack() {
 		unpack ${P}.tar.xz
 	fi
 
-	cd "${S}" || die
-	touch locale/C-translit.h || die #185476 #218003
-
 	cd "${WORKDIR}" || die
 	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-01-08 23:40 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-01-08 23:40 UTC (permalink / raw
  To: gentoo-commits

commit:     945affcfb10bd36d0f7cda9676e990970b8b6754
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  8 23:39:58 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jan  8 23:40:10 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=945affcf

sys-libs/glibc: 2.28 revision bump, work in progress.

This revision should still get a detailed review of the test suite.
Afterwards, it's a reasonable stable candidate.

Bug: https://bugs.gentoo.org/674126
Package-Manager: Portage-2.3.54, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.28-r5.ebuild | 1412 +++++++++++++++++++++++++++++++++++
 2 files changed, 1413 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 69b5d1d0d38..68685fa455b 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,5 +17,6 @@ DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebf
 DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07c1edb24c3edaa1e0243b846b3832a40af1ba3a7b77aef04c54a173388156b464ea442fa8310a02e6f44e2ed5b78994286 SHA512 12496e9b0c60630dbec4c2febdd6d20df1f3d7a2c243cc55b595202b27f682b9208e16cd8c387687c0cc9e18b36c3caeef8d1b1148eb3ee8081431997270db5e
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-2.28-patches-6.tar.xz 89724 BLAKE2B f846534dc912f11ed9b22badfd28ef0402451654390756d2f6332f52ce7c2d3491ed90bbdf2553d7bb38caea6373ad2d3c19e4a1f31f3669948f4e2cbaeb1577 SHA512 f687febde875bb8adb7a61408caea3db99bbbda703eb3486c7d5c09540515e657eda406bf14686498e2c093355c72395502a343201e02cfc97adf6483d8e7455
+DIST glibc-2.28-patches-7.tar.xz 96800 BLAKE2B 9da47b87a4434fd38ffc9e53466e6bfa4b514666c09f0bdcb59e50c5cf4845bcbf66aaea7783bc2f2f232868af88f136b166fddc10d6edff5cc86111a09807ff SHA512 dd8491a9633a0900dea094da2e9d1b3efaf934bbdfb80cd9dd0f1a3c29e955ceacf4cb7b869369ee9aca25bb42845eee1c677c373141fdce72036fba5203ce8a
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-9999-patches-10.tar.xz 17544 BLAKE2B 1cd4fa14b2168e371c769c06a29f36d6dbd3beccb796788470b63282cb8e5c3c497e4eb3800e4bc86c07d3b82935d71dc96dc3155178d52b68873ea38a271a70 SHA512 bbd376ad87fb71de7a6a4eb28030aa1550f7cca57e521d2a326cab63a66e2dc784b93319190f8bb1b24b335acc604d0523c3ea8335a4424373796ebeb79f273b

diff --git a/sys-libs/glibc/glibc-2.28-r5.ebuild b/sys-libs/glibc/glibc-2.28-r5.ebuild
new file mode 100644
index 00000000000..e772e2fc027
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.28-r5.ebuild
@@ -0,0 +1,1412 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=7
+
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	>=net-dns/libidn2-2.0.5
+	sys-apps/gentoo-functions
+	!sys-kernel/ps3-sources
+	!sys-libs/nss-db
+"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+		virtual/os-headers
+	"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake -s glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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' 2>/dev/null ; then
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		amd64)
+			# -march needed for #185404 #199334
+			# Note: This test only matters when the x86 ABI is enabled, so we could
+			# optimize a bit and elide it.
+			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparc64v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparcv9v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Over-zealous CFLAGS can often cause problems.  What may work for one
+	# person may not work for another.  To avoid a large influx of bugs
+	# relating to failed builds, we strip most CFLAGS out to ensure as few
+	# problems as possible.
+	strip-flags
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# Lock glibc at -O2; we want to be conservative here.
+	# -fno-strict-aliasing is to work around #155906.
+	filter-flags '-O?'
+	append-flags -O2 -fno-strict-aliasing
+
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if use headers-only ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ ${ROOT} != "/" ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ ${ROOT} == "/" ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${S}" || die
+	touch locale/C-translit.h || die #185476 #218003
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=all )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		--sysconfdir="${EPREFIX}/etc"
+		--localstatedir="${EPREFIX}/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="${EPREFIX}/sbin"
+	export libc_cv_slibdir="${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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local locale_list="${root}/etc/locale.gen"
+	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+		locale_list="${root}/usr/share/i18n/SUPPORTED"
+	fi
+
+	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}$(alt_prefix)" install || die
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen "${ED}"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_strip() {
+	# gdb is lame and requires some debugging information to remain in
+	# libpthread, so we need to strip it by hand.  libthread_db makes no
+	# sense stripped as it is only used when debugging.
+	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
+	env \
+		-uRESTRICT \
+		CHOST=${CTARGET} \
+		STRIP_MASK="/*/{,tls/}${pthread}*" \
+		prepallstrip
+	# if user has stripping enabled and does not have split debug turned on,
+	# then leave the debugging sections in libpthread.
+	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
+		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
+	fi
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+	src_strip
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ ${ROOT} != "/" ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+	fi
+
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		use compile-locales || run_locale_gen "${EROOT}"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-01-10 21:18 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-01-10 21:18 UTC (permalink / raw
  To: gentoo-commits

commit:     c3b72e5c1158a22fcc17212bb2ba89b8b73f8f0a
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 10 21:17:49 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Jan 10 21:18:24 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c3b72e5c

sys-libs/glibc: 2.28: bump patchlevel (8, only tests); rekeyword

Bug: https://bugs.gentoo.org/674126
Package-Manager: Portage-2.3.54, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             | 2 +-
 sys-libs/glibc/glibc-2.28-r5.ebuild | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 68685fa455b..7c408e625c6 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,6 +17,6 @@ DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebf
 DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07c1edb24c3edaa1e0243b846b3832a40af1ba3a7b77aef04c54a173388156b464ea442fa8310a02e6f44e2ed5b78994286 SHA512 12496e9b0c60630dbec4c2febdd6d20df1f3d7a2c243cc55b595202b27f682b9208e16cd8c387687c0cc9e18b36c3caeef8d1b1148eb3ee8081431997270db5e
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-2.28-patches-6.tar.xz 89724 BLAKE2B f846534dc912f11ed9b22badfd28ef0402451654390756d2f6332f52ce7c2d3491ed90bbdf2553d7bb38caea6373ad2d3c19e4a1f31f3669948f4e2cbaeb1577 SHA512 f687febde875bb8adb7a61408caea3db99bbbda703eb3486c7d5c09540515e657eda406bf14686498e2c093355c72395502a343201e02cfc97adf6483d8e7455
-DIST glibc-2.28-patches-7.tar.xz 96800 BLAKE2B 9da47b87a4434fd38ffc9e53466e6bfa4b514666c09f0bdcb59e50c5cf4845bcbf66aaea7783bc2f2f232868af88f136b166fddc10d6edff5cc86111a09807ff SHA512 dd8491a9633a0900dea094da2e9d1b3efaf934bbdfb80cd9dd0f1a3c29e955ceacf4cb7b869369ee9aca25bb42845eee1c677c373141fdce72036fba5203ce8a
+DIST glibc-2.28-patches-8.tar.xz 97384 BLAKE2B 036ab39103aa30be61fcbb46a7103cf83c1dd490eeff526444d4701b92e06a428133de2d005d65a296f14f28145f143a2386f8b17df721174a0a0b5303e99931 SHA512 29695212d8ca9c4b6d4787f4919b75cb0828ddecce65d65683b746ed23acb50e4e18419a13bb6ee4a234f44f63b38a2eebf1f1ce3d350435c2bf21d6076a97a6
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-9999-patches-10.tar.xz 17544 BLAKE2B 1cd4fa14b2168e371c769c06a29f36d6dbd3beccb796788470b63282cb8e5c3c497e4eb3800e4bc86c07d3b82935d71dc96dc3155178d52b68873ea38a271a70 SHA512 bbd376ad87fb71de7a6a4eb28030aa1550f7cca57e521d2a326cab63a66e2dc784b93319190f8bb1b24b335acc604d0523c3ea8335a4424373796ebeb79f273b

diff --git a/sys-libs/glibc/glibc-2.28-r5.ebuild b/sys-libs/glibc/glibc-2.28-r5.ebuild
index e772e2fc027..0c69246759a 100644
--- a/sys-libs/glibc/glibc-2.28-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r5.ebuild
@@ -18,8 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 
@@ -28,7 +27,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=7
+PATCH_VER=8
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-01-14  0:00 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-01-14  0:00 UTC (permalink / raw
  To: gentoo-commits

commit:     305ab84842a4dc2247eb56be8148266857df05d3
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 14 00:00:04 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jan 14 00:00:04 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=305ab848

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.55, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.28-r4.ebuild | 1411 -----------------------------------
 2 files changed, 1412 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 7c408e625c6..583bd6884eb 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,7 +16,6 @@ DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
 DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07c1edb24c3edaa1e0243b846b3832a40af1ba3a7b77aef04c54a173388156b464ea442fa8310a02e6f44e2ed5b78994286 SHA512 12496e9b0c60630dbec4c2febdd6d20df1f3d7a2c243cc55b595202b27f682b9208e16cd8c387687c0cc9e18b36c3caeef8d1b1148eb3ee8081431997270db5e
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
-DIST glibc-2.28-patches-6.tar.xz 89724 BLAKE2B f846534dc912f11ed9b22badfd28ef0402451654390756d2f6332f52ce7c2d3491ed90bbdf2553d7bb38caea6373ad2d3c19e4a1f31f3669948f4e2cbaeb1577 SHA512 f687febde875bb8adb7a61408caea3db99bbbda703eb3486c7d5c09540515e657eda406bf14686498e2c093355c72395502a343201e02cfc97adf6483d8e7455
 DIST glibc-2.28-patches-8.tar.xz 97384 BLAKE2B 036ab39103aa30be61fcbb46a7103cf83c1dd490eeff526444d4701b92e06a428133de2d005d65a296f14f28145f143a2386f8b17df721174a0a0b5303e99931 SHA512 29695212d8ca9c4b6d4787f4919b75cb0828ddecce65d65683b746ed23acb50e4e18419a13bb6ee4a234f44f63b38a2eebf1f1ce3d350435c2bf21d6076a97a6
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-9999-patches-10.tar.xz 17544 BLAKE2B 1cd4fa14b2168e371c769c06a29f36d6dbd3beccb796788470b63282cb8e5c3c497e4eb3800e4bc86c07d3b82935d71dc96dc3155178d52b68873ea38a271a70 SHA512 bbd376ad87fb71de7a6a4eb28030aa1550f7cca57e521d2a326cab63a66e2dc784b93319190f8bb1b24b335acc604d0523c3ea8335a4424373796ebeb79f273b

diff --git a/sys-libs/glibc/glibc-2.28-r4.ebuild b/sys-libs/glibc/glibc-2.28-r4.ebuild
deleted file mode 100644
index bbe2505ad88..00000000000
--- a/sys-libs/glibc/glibc-2.28-r4.ebuild
+++ /dev/null
@@ -1,1411 +0,0 @@
-# Copyright 1999-2018 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=6
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	>=net-dns/libidn2-2.0.5
-	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-		virtual/os-headers
-	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if use headers-only ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}" || die
-	touch locale/C-translit.h || die #185476 #218003
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=all )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-		locale_list="${root}/usr/share/i18n/SUPPORTED"
-	fi
-
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-02-01 10:55 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-02-01 10:55 UTC (permalink / raw
  To: gentoo-commits

commit:     38d96abd212c966f304d36c314c824a6335df64d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  1 10:53:21 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Feb  1 10:55:23 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=38d96abd

sys-libs/glibc: Version bump, unkeyworded

Builds, and tests are ok-ish, no further testing done yet

FAIL: nss/tst-nss-files-alias-leak
FAIL: nss/tst-nss-test3
FAIL: rt/tst-cputimer1
FAIL: rt/tst-cputimer2
FAIL: rt/tst-cputimer3
FAIL: conform/*/*/linknamespace
(the latter because of system 2.27)

Package-Manager: Portage-2.3.59, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest                                 | 2 ++
 sys-libs/glibc/{glibc-9999.ebuild => glibc-2.29.ebuild} | 9 ++++++---
 sys-libs/glibc/glibc-9999.ebuild                        | 7 +++++--
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 583bd6884eb..d7af4ea3dec 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,4 +18,6 @@ DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-2.28-patches-8.tar.xz 97384 BLAKE2B 036ab39103aa30be61fcbb46a7103cf83c1dd490eeff526444d4701b92e06a428133de2d005d65a296f14f28145f143a2386f8b17df721174a0a0b5303e99931 SHA512 29695212d8ca9c4b6d4787f4919b75cb0828ddecce65d65683b746ed23acb50e4e18419a13bb6ee4a234f44f63b38a2eebf1f1ce3d350435c2bf21d6076a97a6
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
+DIST glibc-2.29-patches-1.tar.xz 17768 BLAKE2B d835c62552ff8650c81156cfff6962fbb3a31c1b9498b0e9fd0a2f0847c99d6127c1662d3fe46a77d5bce8f4a4c850047b99c4567c74bef96b410bbd53d3b65a SHA512 9231e1067298e5c044ed8f6eaff1b117ebaa3eeb05adecb85ed31e927ec6805e7109b6d137b31def4d07f389fcdb5102c9ef705772f4d2ccb2eee8a73f6e3ce3
+DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-9999-patches-10.tar.xz 17544 BLAKE2B 1cd4fa14b2168e371c769c06a29f36d6dbd3beccb796788470b63282cb8e5c3c497e4eb3800e4bc86c07d3b82935d71dc96dc3155178d52b68873ea38a271a70 SHA512 bbd376ad87fb71de7a6a4eb28030aa1550f7cca57e521d2a326cab63a66e2dc784b93319190f8bb1b24b335acc604d0523c3ea8335a4424373796ebeb79f273b

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.29.ebuild
similarity index 99%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.29.ebuild
index ea9f2ab2563..6ef8c8b6f23 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.29.ebuild
@@ -1,9 +1,11 @@
-# Copyright 1999-2018 Gentoo Authors
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
 
-inherit prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
+PYTHON_COMPAT=( python3_{4,5,6,7} )
+
+inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"
@@ -28,7 +30,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=10
+PATCH_VER=1
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
@@ -73,6 +75,7 @@ COMMON_DEPEND="
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
+	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
 	!<sys-apps/sandbox-1.6

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ea9f2ab2563..6b5bd388a30 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1,9 +1,11 @@
-# Copyright 1999-2018 Gentoo Authors
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
 
-inherit prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
+PYTHON_COMPAT=( python3_{4,5,6,7} )
+
+inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"
@@ -73,6 +75,7 @@ COMMON_DEPEND="
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
+	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
 	!<sys-apps/sandbox-1.6


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-02-07 23:02 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-02-07 23:02 UTC (permalink / raw
  To: gentoo-commits

commit:     3a821c3499a6f99b780eec2d5dd81c785535600c
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  7 23:01:12 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Feb  7 23:02:38 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3a821c34

sys-libs/glibc: ignore USE=headers-only for native case, bug #677474

Let's not allow users to "deinstall" native glibc.

Reported-by: Toralf Förster
Closes: https://bugs.gentoo.org/677474
Package-Manager: Portage-2.3.59, Repoman-2.3.12
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.27-r6.ebuild | 4 ++--
 sys-libs/glibc/glibc-2.28-r5.ebuild | 2 +-
 sys-libs/glibc/glibc-2.29.ebuild    | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 7125f84f4da..668e6795b24 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Authors
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -459,7 +459,7 @@ setup_env() {
 
 	export ABI=${ABI:-${DEFAULT_ABI:-default}}
 
-	if use headers-only ; then
+	if just_headers ; then
 		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
 		# At this bootstrap stage we have only binutils for
 		# target but not compiler yet.

diff --git a/sys-libs/glibc/glibc-2.28-r5.ebuild b/sys-libs/glibc/glibc-2.28-r5.ebuild
index 0c69246759a..827b432313e 100644
--- a/sys-libs/glibc/glibc-2.28-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r5.ebuild
@@ -448,7 +448,7 @@ setup_env() {
 
 	export ABI=${ABI:-${DEFAULT_ABI:-default}}
 
-	if use headers-only ; then
+	if just_headers ; then
 		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
 		# At this bootstrap stage we have only binutils for
 		# target but not compiler yet.

diff --git a/sys-libs/glibc/glibc-2.29.ebuild b/sys-libs/glibc/glibc-2.29.ebuild
index 6ef8c8b6f23..3089cdbb5f1 100644
--- a/sys-libs/glibc/glibc-2.29.ebuild
+++ b/sys-libs/glibc/glibc-2.29.ebuild
@@ -452,7 +452,7 @@ setup_env() {
 
 	export ABI=${ABI:-${DEFAULT_ABI:-default}}
 
-	if use headers-only ; then
+	if just_headers ; then
 		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
 		# At this bootstrap stage we have only binutils for
 		# target but not compiler yet.

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 6b5bd388a30..1dcf217a492 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -452,7 +452,7 @@ setup_env() {
 
 	export ABI=${ABI:-${DEFAULT_ABI:-default}}
 
-	if use headers-only ; then
+	if just_headers ; then
 		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
 		# At this bootstrap stage we have only binutils for
 		# target but not compiler yet.


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-02-10 23:47 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-02-10 23:47 UTC (permalink / raw
  To: gentoo-commits

commit:     d74781e680bee416a48c648df1f8c6000da84e4d
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 10 23:38:46 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Feb 10 23:47:39 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d74781e6

sys-libs/glibc: disable stack protector on m68k

setjmp() clobbers 'a5' register by stack protector prologue.

Bug: https://sourceware.org/PR24202
Package-Manager: Portage-2.3.59, Repoman-2.3.12
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.27-r6.ebuild | 5 +++++
 sys-libs/glibc/glibc-2.28-r5.ebuild | 5 +++++
 sys-libs/glibc/glibc-2.29.ebuild    | 5 +++++
 3 files changed, 15 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 668e6795b24..157ab8b051d 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -809,6 +809,11 @@ glibc_do_configure() {
 	local myconf=()
 
 	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
 		powerpc-*)
 			# Currently gcc on powerpc32 generates invalid code for
 			# __builtin_return_address(0) calls. Normally programs

diff --git a/sys-libs/glibc/glibc-2.28-r5.ebuild b/sys-libs/glibc/glibc-2.28-r5.ebuild
index 827b432313e..9087d26caaf 100644
--- a/sys-libs/glibc/glibc-2.28-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r5.ebuild
@@ -799,6 +799,11 @@ glibc_do_configure() {
 	local myconf=()
 
 	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
 		powerpc-*)
 			# Currently gcc on powerpc32 generates invalid code for
 			# __builtin_return_address(0) calls. Normally programs

diff --git a/sys-libs/glibc/glibc-2.29.ebuild b/sys-libs/glibc/glibc-2.29.ebuild
index 3089cdbb5f1..4ac98457b48 100644
--- a/sys-libs/glibc/glibc-2.29.ebuild
+++ b/sys-libs/glibc/glibc-2.29.ebuild
@@ -800,6 +800,11 @@ glibc_do_configure() {
 	local myconf=()
 
 	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
 		powerpc-*)
 			# Currently gcc on powerpc32 generates invalid code for
 			# __builtin_return_address(0) calls. Normally programs


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-03-09 10:47 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-03-09 10:47 UTC (permalink / raw
  To: gentoo-commits

commit:     30c9f8fcc43187ca1df2bf7fdb5c89a21ecd71ce
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Mar  9 09:47:45 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Mar  9 10:46:39 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=30c9f8fc

sys-libs/glibc: sort flags in metadata.xml

Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/metadata.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index be2851b8215..86b9046f11c 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -6,6 +6,7 @@
  <name>Gentoo Toolchain Project</name>
 </maintainer>
 <use>
+ <flag name="cet">Enable Intel Control-flow Enforcement Technology (needs binutils 2.29 and gcc 8)</flag>
  <flag name="compile-locales">build *all* locales in src_install; this is generally meant for stage building only as it ignores /etc/locale.gen file and can be pretty slow</flag>
  <flag name="debug">When USE=hardened, allow fortify/stack violations to dump core (SIGABRT) and not kill self (SIGKILL)</flag>
  <flag name="gd">build memusage and memusagestat tools</flag>
@@ -14,7 +15,6 @@
  <flag name="rpc">Enable obsolete RPC/NIS layers</flag>
  <flag name="suid">Make internal pt_chown helper setuid -- not needed if using Linux and have /dev/pts mounted with gid=5</flag>
  <flag name="systemtap">enable systemtap static probe points</flag>
- <flag name="cet">Enable Intel Control-flow Enforcement Technology (needs binutils 2.29 and gcc 8)</flag>
 </use>
 <upstream>
  <remote-id type="cpe">cpe:/a:gnu:glibc</remote-id>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-03-09 10:47 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-03-09 10:47 UTC (permalink / raw
  To: gentoo-commits

commit:     5aca3ae8606fb422955eedb5e45d50166e91c339
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Mar  9 10:46:05 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Mar  9 10:46:40 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5aca3ae8

sys-libs/glibc: make stack protection optional, bug #679788

The change adds new USE=ssp to optionally disable protection of
glibc's internals. Before the change protection was
unconditionally enabled.

It's useful to disable ssp to validate if stack protection
causes any damage (glibc bugs like https://sourceware.org/PR24202
or gcc bugs like https://gcc.gnu.org/PR81996).

And also useful to get more predictable binaries like in
https://bugs.gentoo.org/679788.

Reported-by: Agostino Sarubbo
Bug: https://bugs.gentoo.org/679788
Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.28-r5.ebuild | 4 ++--
 sys-libs/glibc/glibc-2.29.ebuild    | 4 ++--
 sys-libs/glibc/glibc-9999.ebuild    | 9 +++++++--
 sys-libs/glibc/metadata.xml         | 1 +
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.28-r5.ebuild b/sys-libs/glibc/glibc-2.28-r5.ebuild
index 9087d26caaf..3ae8a3553cb 100644
--- a/sys-libs/glibc/glibc-2.28-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r5.ebuild
@@ -32,7 +32,7 @@ PATCH_VER=8
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
+IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -813,7 +813,7 @@ glibc_do_configure() {
 			myconf+=( --enable-stack-protector=no )
 			;;
 		*)
-			myconf+=( --enable-stack-protector=all )
+			myconf+=( --enable-stack-protector=$(usex ssp all no) )
 			;;
 	esac
 	myconf+=( --enable-stackguard-randomization )

diff --git a/sys-libs/glibc/glibc-2.29.ebuild b/sys-libs/glibc/glibc-2.29.ebuild
index 4ac98457b48..98113f0210b 100644
--- a/sys-libs/glibc/glibc-2.29.ebuild
+++ b/sys-libs/glibc/glibc-2.29.ebuild
@@ -35,7 +35,7 @@ PATCH_VER=1
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
+IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -814,7 +814,7 @@ glibc_do_configure() {
 			myconf+=( --enable-stack-protector=no )
 			;;
 		*)
-			myconf+=( --enable-stack-protector=all )
+			myconf+=( --enable-stack-protector=$(usex ssp all no) )
 			;;
 	esac
 	myconf+=( --enable-stackguard-randomization )

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 1dcf217a492..b488b70b701 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -35,7 +35,7 @@ PATCH_VER=10
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla"
+IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -800,6 +800,11 @@ glibc_do_configure() {
 	local myconf=()
 
 	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
 		powerpc-*)
 			# Currently gcc on powerpc32 generates invalid code for
 			# __builtin_return_address(0) calls. Normally programs
@@ -809,7 +814,7 @@ glibc_do_configure() {
 			myconf+=( --enable-stack-protector=no )
 			;;
 		*)
-			myconf+=( --enable-stack-protector=all )
+			myconf+=( --enable-stack-protector=$(usex ssp all no) )
 			;;
 	esac
 	myconf+=( --enable-stackguard-randomization )

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index 86b9046f11c..58d861be030 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -13,6 +13,7 @@
  <flag name="multiarch">enable optimizations for multiple CPU architectures (detected at runtime)</flag>
  <flag name="nscd">Build, and enable support for, the Name Service Cache Daemon</flag>
  <flag name="rpc">Enable obsolete RPC/NIS layers</flag>
+ <flag name="ssp">protect stack of glibc internals</flag>
  <flag name="suid">Make internal pt_chown helper setuid -- not needed if using Linux and have /dev/pts mounted with gid=5</flag>
  <flag name="systemtap">enable systemtap static probe points</flag>
 </use>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-03-12  8:45 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-03-12  8:45 UTC (permalink / raw
  To: gentoo-commits

commit:     0e52d5e74b34aece67a1275d0d800c558cfa565e
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 12 08:45:12 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Mar 12 08:45:31 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0e52d5e7

sys-libs/glibc: cut 11 patchset, bug #679980

Patchset 11 is the same as patchset 10 rebased on top of
current master. One minor conflict is fixed in patch removal.

Reported-by: jospezial
Closes: https://bugs.gentoo.org/679980
Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index d7af4ea3dec..a0065910d5b 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,4 +20,4 @@ DIST glibc-2.28-patches-8.tar.xz 97384 BLAKE2B 036ab39103aa30be61fcbb46a7103cf83
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-2.29-patches-1.tar.xz 17768 BLAKE2B d835c62552ff8650c81156cfff6962fbb3a31c1b9498b0e9fd0a2f0847c99d6127c1662d3fe46a77d5bce8f4a4c850047b99c4567c74bef96b410bbd53d3b65a SHA512 9231e1067298e5c044ed8f6eaff1b117ebaa3eeb05adecb85ed31e927ec6805e7109b6d137b31def4d07f389fcdb5102c9ef705772f4d2ccb2eee8a73f6e3ce3
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
-DIST glibc-9999-patches-10.tar.xz 17544 BLAKE2B 1cd4fa14b2168e371c769c06a29f36d6dbd3beccb796788470b63282cb8e5c3c497e4eb3800e4bc86c07d3b82935d71dc96dc3155178d52b68873ea38a271a70 SHA512 bbd376ad87fb71de7a6a4eb28030aa1550f7cca57e521d2a326cab63a66e2dc784b93319190f8bb1b24b335acc604d0523c3ea8335a4424373796ebeb79f273b
+DIST glibc-9999-patches-11.tar.xz 17804 BLAKE2B cb4ef9fbaf0da3e2307c468d2a6731ff2475f6ebc490f0ca43d375b59aa669bec1ad0580775306adb95e249e9641bed910310185e5dced66a491c1491b99a747 SHA512 d2fced779807c7f492c17958cf4f95273d1bdcfe062bd71546f2360f3d4742a696ec8d04d984ec560c0fcccea332446834ae2c9d28cfd9009ffd091c1084edc9

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index b488b70b701..417b38d3008 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -30,9 +30,9 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=10
+PATCH_VER=11
 
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
 IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-03-14 19:41 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-03-14 19:41 UTC (permalink / raw
  To: gentoo-commits

commit:     7425a3be94828a407015adfc8f4cdebdad894b6f
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Thu Mar 14 17:39:04 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Mar 14 19:40:55 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7425a3be

sys-libs/glibc: stable 2.28-r5 for sparc, bug #674126

Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Package-Manager: Portage-2.3.51, Repoman-2.3.11
RepoMan-Options: --include-arches="sparc"
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.28-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.28-r5.ebuild b/sys-libs/glibc/glibc-2.28-r5.ebuild
index 3ae8a3553cb..ca6da16c055 100644
--- a/sys-libs/glibc/glibc-2.28-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r5.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-03-15 10:01 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2019-03-15 10:01 UTC (permalink / raw
  To: gentoo-commits

commit:     c8a9b129476aa9ade7ee1d052cb39921ef16a389
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 15 10:00:32 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Fri Mar 15 10:00:32 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8a9b129

sys-libs/glibc: s390 stable wrt bug #674126

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>
Package-Manager: Portage-2.3.62, Repoman-2.3.11
RepoMan-Options: --include-arches="s390"

 sys-libs/glibc/glibc-2.28-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.28-r5.ebuild b/sys-libs/glibc/glibc-2.28-r5.ebuild
index ca6da16c055..b69c101d868 100644
--- a/sys-libs/glibc/glibc-2.28-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r5.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 s390 ~sh sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-03-16 14:01 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2019-03-16 14:01 UTC (permalink / raw
  To: gentoo-commits

commit:     01afeb279e35537572882b1b3b4b36f31086d9ca
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 16 13:58:24 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Sat Mar 16 13:58:24 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=01afeb27

sys-libs/glibc: arm stable wrt bug #674126

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>
Package-Manager: Portage-2.3.62, Repoman-2.3.11
RepoMan-Options: --include-arches="arm"

 sys-libs/glibc/glibc-2.28-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.28-r5.ebuild b/sys-libs/glibc/glibc-2.28-r5.ebuild
index b69c101d868..e10a6d48b73 100644
--- a/sys-libs/glibc/glibc-2.28-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r5.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 s390 ~sh sparc ~x86"
+	KEYWORDS="~alpha ~amd64 arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 s390 ~sh sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-03-24 17:00 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2019-03-24 17:00 UTC (permalink / raw
  To: gentoo-commits

commit:     f4900b835df279602c8d8f8594ec7d4a623b94ae
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 24 17:00:11 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Sun Mar 24 17:00:37 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f4900b83

sys-libs/glibc: amd64 stable wrt bug #674126

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>
Package-Manager: Portage-2.3.62, Repoman-2.3.11
RepoMan-Options: --include-arches="amd64"

 sys-libs/glibc/glibc-2.28-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.28-r5.ebuild b/sys-libs/glibc/glibc-2.28-r5.ebuild
index e10a6d48b73..2bdf8ec2bb5 100644
--- a/sys-libs/glibc/glibc-2.28-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r5.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 s390 ~sh sparc ~x86"
+	KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 s390 ~sh sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-03-24 21:06 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-03-24 21:06 UTC (permalink / raw
  To: gentoo-commits

commit:     af53cec2d995432f8e75a37aa2b7636d00965e59
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 24 21:06:10 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Mar 24 21:06:39 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=af53cec2

sys-libs/glibc: New unkeyworded 2.29 revision

Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.29-r1.ebuild | 1417 +++++++++++++++++++++++++++++++++++
 2 files changed, 1418 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index a0065910d5b..d9415ec9ae8 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,5 +19,6 @@ DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea
 DIST glibc-2.28-patches-8.tar.xz 97384 BLAKE2B 036ab39103aa30be61fcbb46a7103cf83c1dd490eeff526444d4701b92e06a428133de2d005d65a296f14f28145f143a2386f8b17df721174a0a0b5303e99931 SHA512 29695212d8ca9c4b6d4787f4919b75cb0828ddecce65d65683b746ed23acb50e4e18419a13bb6ee4a234f44f63b38a2eebf1f1ce3d350435c2bf21d6076a97a6
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-2.29-patches-1.tar.xz 17768 BLAKE2B d835c62552ff8650c81156cfff6962fbb3a31c1b9498b0e9fd0a2f0847c99d6127c1662d3fe46a77d5bce8f4a4c850047b99c4567c74bef96b410bbd53d3b65a SHA512 9231e1067298e5c044ed8f6eaff1b117ebaa3eeb05adecb85ed31e927ec6805e7109b6d137b31def4d07f389fcdb5102c9ef705772f4d2ccb2eee8a73f6e3ce3
+DIST glibc-2.29-patches-2.tar.xz 35176 BLAKE2B a98d309686068dac5ae7eceac102610f9058e620f62661d9cd7fdbdb31608844cb254e15311ff2ac85be97bdf3d953fde625e3b088e4833c0356f6f4472f52d7 SHA512 69bbd090886942595cf47e2bdf01fc7ed8c0b8f2b7a4f8a6749b74a392a12d9cc601212cce09db434841f3740ff1a81642b8019afbdbfa8903ae4ebc5a71c801
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-9999-patches-11.tar.xz 17804 BLAKE2B cb4ef9fbaf0da3e2307c468d2a6731ff2475f6ebc490f0ca43d375b59aa669bec1ad0580775306adb95e249e9641bed910310185e5dced66a491c1491b99a747 SHA512 d2fced779807c7f492c17958cf4f95273d1bdcfe062bd71546f2360f3d4742a696ec8d04d984ec560c0fcccea332446834ae2c9d28cfd9009ffd091c1084edc9

diff --git a/sys-libs/glibc/glibc-2.29-r1.ebuild b/sys-libs/glibc/glibc-2.29-r1.ebuild
new file mode 100644
index 00000000000..eba80bd41ff
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.29-r1.ebuild
@@ -0,0 +1,1417 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python3_{4,5,6,7} )
+
+inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=2
+
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	>=net-dns/libidn2-2.0.5
+	sys-apps/gentoo-functions
+	!sys-kernel/ps3-sources
+	!sys-libs/nss-db
+"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+		virtual/os-headers
+	"
+	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake -s glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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' 2>/dev/null ; then
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		amd64)
+			# -march needed for #185404 #199334
+			# Note: This test only matters when the x86 ABI is enabled, so we could
+			# optimize a bit and elide it.
+			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparc64v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparcv9v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Over-zealous CFLAGS can often cause problems.  What may work for one
+	# person may not work for another.  To avoid a large influx of bugs
+	# relating to failed builds, we strip most CFLAGS out to ensure as few
+	# problems as possible.
+	strip-flags
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# Lock glibc at -O2; we want to be conservative here.
+	# -fno-strict-aliasing is to work around #155906.
+	filter-flags '-O?'
+	append-flags -O2 -fno-strict-aliasing
+
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ ${ROOT} != "/" ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ ${ROOT} == "/" ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=$(usex ssp all no) )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		--sysconfdir="${EPREFIX}/etc"
+		--localstatedir="${EPREFIX}/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="${EPREFIX}/sbin"
+	export libc_cv_slibdir="${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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="${EPREFIX}/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local locale_list="${root}/etc/locale.gen"
+	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+		locale_list="${root}/usr/share/i18n/SUPPORTED"
+	fi
+
+	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}$(alt_prefix)" install || die
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen "${ED}"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_strip() {
+	# gdb is lame and requires some debugging information to remain in
+	# libpthread, so we need to strip it by hand.  libthread_db makes no
+	# sense stripped as it is only used when debugging.
+	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
+	env \
+		-uRESTRICT \
+		CHOST=${CTARGET} \
+		STRIP_MASK="/*/{,tls/}${pthread}*" \
+		prepallstrip
+	# if user has stripping enabled and does not have split debug turned on,
+	# then leave the debugging sections in libpthread.
+	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
+		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
+	fi
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+	src_strip
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ ${ROOT} != "/" ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+	fi
+
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		use compile-locales || run_locale_gen "${EROOT}"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-03-25 21:16 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-03-25 21:16 UTC (permalink / raw
  To: gentoo-commits

commit:     00a8e87b3afc16af56632d08884263623800bd99
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 25 21:16:14 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon Mar 25 21:16:43 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=00a8e87b

sys-libs/glibc: avoid libidn2 in bootstrap, bug #681742

When bootstrapping a cross-toolchain don't pull in libidn2 into
the host as it's not stable yet everywhere (requires KEYWORDS
fiddling) and is not needed on host (it's cross-glibc).

Reported-by: Mahmoud Jaoune
Bug: https://bugs.gentoo.org/681742
Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.28-r5.ebuild | 6 ++++--
 sys-libs/glibc/glibc-2.29-r1.ebuild | 6 ++++--
 sys-libs/glibc/glibc-2.29.ebuild    | 6 ++++--
 sys-libs/glibc/glibc-9999.ebuild    | 6 ++++--
 4 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.28-r5.ebuild b/sys-libs/glibc/glibc-2.28-r5.ebuild
index 2bdf8ec2bb5..b006cb19449 100644
--- a/sys-libs/glibc/glibc-2.28-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r5.ebuild
@@ -82,7 +82,6 @@ DEPEND="${COMMON_DEPEND}
 	test? ( >=net-dns/libidn2-2.0.5 )
 "
 RDEPEND="${COMMON_DEPEND}
-	>=net-dns/libidn2-2.0.5
 	sys-apps/gentoo-functions
 	!sys-kernel/ps3-sources
 	!sys-libs/nss-db
@@ -100,7 +99,10 @@ else
 		>=sys-devel/gcc-6
 		virtual/os-headers
 	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	RDEPEND+="
+		>=net-dns/libidn2-2.0.5
+		vanilla? ( !sys-libs/timezone-data )
+	"
 	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
 fi
 

diff --git a/sys-libs/glibc/glibc-2.29-r1.ebuild b/sys-libs/glibc/glibc-2.29-r1.ebuild
index eba80bd41ff..1beb44e7ca9 100644
--- a/sys-libs/glibc/glibc-2.29-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r1.ebuild
@@ -86,7 +86,6 @@ DEPEND="${COMMON_DEPEND}
 	test? ( >=net-dns/libidn2-2.0.5 )
 "
 RDEPEND="${COMMON_DEPEND}
-	>=net-dns/libidn2-2.0.5
 	sys-apps/gentoo-functions
 	!sys-kernel/ps3-sources
 	!sys-libs/nss-db
@@ -104,7 +103,10 @@ else
 		>=sys-devel/gcc-6
 		virtual/os-headers
 	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	RDEPEND+="
+		>=net-dns/libidn2-2.0.5
+		vanilla? ( !sys-libs/timezone-data )
+	"
 	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
 fi
 

diff --git a/sys-libs/glibc/glibc-2.29.ebuild b/sys-libs/glibc/glibc-2.29.ebuild
index 98113f0210b..e2028c49d8f 100644
--- a/sys-libs/glibc/glibc-2.29.ebuild
+++ b/sys-libs/glibc/glibc-2.29.ebuild
@@ -86,7 +86,6 @@ DEPEND="${COMMON_DEPEND}
 	test? ( >=net-dns/libidn2-2.0.5 )
 "
 RDEPEND="${COMMON_DEPEND}
-	>=net-dns/libidn2-2.0.5
 	sys-apps/gentoo-functions
 	!sys-kernel/ps3-sources
 	!sys-libs/nss-db
@@ -104,7 +103,10 @@ else
 		>=sys-devel/gcc-6
 		virtual/os-headers
 	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	RDEPEND+="
+		>=net-dns/libidn2-2.0.5
+		vanilla? ( !sys-libs/timezone-data )
+	"
 	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
 fi
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 417b38d3008..478b5e5c9dc 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -86,7 +86,6 @@ DEPEND="${COMMON_DEPEND}
 	test? ( >=net-dns/libidn2-2.0.5 )
 "
 RDEPEND="${COMMON_DEPEND}
-	>=net-dns/libidn2-2.0.5
 	sys-apps/gentoo-functions
 	!sys-kernel/ps3-sources
 	!sys-libs/nss-db
@@ -104,7 +103,10 @@ else
 		>=sys-devel/gcc-6
 		virtual/os-headers
 	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+	RDEPEND+="
+		>=net-dns/libidn2-2.0.5
+		vanilla? ( !sys-libs/timezone-data )
+	"
 	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-03-26 21:08 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-03-26 21:08 UTC (permalink / raw
  To: gentoo-commits

commit:     16e1c37bdc84b2ac5df10511f63e478d8e49435e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 26 21:08:30 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Mar 26 21:08:30 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=16e1c37b

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          |    1 -
 sys-libs/glibc/glibc-2.29.ebuild | 1419 --------------------------------------
 2 files changed, 1420 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index d9415ec9ae8..9277ce2fb44 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,7 +18,6 @@ DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-2.28-patches-8.tar.xz 97384 BLAKE2B 036ab39103aa30be61fcbb46a7103cf83c1dd490eeff526444d4701b92e06a428133de2d005d65a296f14f28145f143a2386f8b17df721174a0a0b5303e99931 SHA512 29695212d8ca9c4b6d4787f4919b75cb0828ddecce65d65683b746ed23acb50e4e18419a13bb6ee4a234f44f63b38a2eebf1f1ce3d350435c2bf21d6076a97a6
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
-DIST glibc-2.29-patches-1.tar.xz 17768 BLAKE2B d835c62552ff8650c81156cfff6962fbb3a31c1b9498b0e9fd0a2f0847c99d6127c1662d3fe46a77d5bce8f4a4c850047b99c4567c74bef96b410bbd53d3b65a SHA512 9231e1067298e5c044ed8f6eaff1b117ebaa3eeb05adecb85ed31e927ec6805e7109b6d137b31def4d07f389fcdb5102c9ef705772f4d2ccb2eee8a73f6e3ce3
 DIST glibc-2.29-patches-2.tar.xz 35176 BLAKE2B a98d309686068dac5ae7eceac102610f9058e620f62661d9cd7fdbdb31608844cb254e15311ff2ac85be97bdf3d953fde625e3b088e4833c0356f6f4472f52d7 SHA512 69bbd090886942595cf47e2bdf01fc7ed8c0b8f2b7a4f8a6749b74a392a12d9cc601212cce09db434841f3740ff1a81642b8019afbdbfa8903ae4ebc5a71c801
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-9999-patches-11.tar.xz 17804 BLAKE2B cb4ef9fbaf0da3e2307c468d2a6731ff2475f6ebc490f0ca43d375b59aa669bec1ad0580775306adb95e249e9641bed910310185e5dced66a491c1491b99a747 SHA512 d2fced779807c7f492c17958cf4f95273d1bdcfe062bd71546f2360f3d4742a696ec8d04d984ec560c0fcccea332446834ae2c9d28cfd9009ffd091c1084edc9

diff --git a/sys-libs/glibc/glibc-2.29.ebuild b/sys-libs/glibc/glibc-2.29.ebuild
deleted file mode 100644
index e2028c49d8f..00000000000
--- a/sys-libs/glibc/glibc-2.29.ebuild
+++ /dev/null
@@ -1,1419 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-PYTHON_COMPAT=( python3_{4,5,6,7} )
-
-inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=1
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-		virtual/os-headers
-	"
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all no) )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-		locale_list="${root}/usr/share/i18n/SUPPORTED"
-	fi
-
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-03-30 14:29 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-03-30 14:29 UTC (permalink / raw
  To: gentoo-commits

commit:     511691f49d06d0e4a910e5f616a017b3e87b2a2f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 30 14:28:14 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Mar 30 14:28:52 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=511691f4

sys-libs/glibc: Re-keyword glibc-2.29

Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r1.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.29-r1.ebuild b/sys-libs/glibc/glibc-2.29-r1.ebuild
index 1beb44e7ca9..34fad50ec4f 100644
--- a/sys-libs/glibc/glibc-2.29-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r1.ebuild
@@ -20,8 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-04-02 12:08 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2019-04-02 12:08 UTC (permalink / raw
  To: gentoo-commits

commit:     e4b01c0bf81041eafa8cef253c73c7dba80be7e0
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Tue Apr  2 12:07:15 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Tue Apr  2 12:07:15 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4b01c0b

sys-libs/glibc: sh stable wrt bug #674126

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>
Package-Manager: Portage-2.3.62, Repoman-2.3.11
RepoMan-Options: --include-arches="sh"

 sys-libs/glibc/glibc-2.28-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.28-r5.ebuild b/sys-libs/glibc/glibc-2.28-r5.ebuild
index b006cb19449..322f4fe6d85 100644
--- a/sys-libs/glibc/glibc-2.28-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r5.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 s390 ~sh sparc ~x86"
+	KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 s390 sh sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-04-02 12:08 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2019-04-02 12:08 UTC (permalink / raw
  To: gentoo-commits

commit:     2a777d6c5d0297887d3b908e5f93a9129a33201a
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Tue Apr  2 12:07:38 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Tue Apr  2 12:07:38 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2a777d6c

sys-libs/glibc: m68k stable wrt bug #674126

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>
Package-Manager: Portage-2.3.62, Repoman-2.3.11
RepoMan-Options: --include-arches="m68k"

 sys-libs/glibc/glibc-2.28-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.28-r5.ebuild b/sys-libs/glibc/glibc-2.28-r5.ebuild
index 322f4fe6d85..afb24ebc97b 100644
--- a/sys-libs/glibc/glibc-2.28-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r5.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 s390 sh sparc ~x86"
+	KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-04-07 16:40 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-04-07 16:40 UTC (permalink / raw
  To: gentoo-commits

commit:     7e61f620c7b29dc9663011eaeadec89d8febb667
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  7 16:40:12 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Apr  7 16:40:26 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7e61f620

sys-libs/glibc: Add japanese era change information

Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest                                      |  3 ++-
 .../glibc/{glibc-2.29-r1.ebuild => glibc-2.28-r6.ebuild}     | 12 ++++++------
 .../glibc/{glibc-2.29-r1.ebuild => glibc-2.29-r2.ebuild}     |  2 +-
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 9277ce2fb44..1aa277b0a0c 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,7 +17,8 @@ DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebf
 DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07c1edb24c3edaa1e0243b846b3832a40af1ba3a7b77aef04c54a173388156b464ea442fa8310a02e6f44e2ed5b78994286 SHA512 12496e9b0c60630dbec4c2febdd6d20df1f3d7a2c243cc55b595202b27f682b9208e16cd8c387687c0cc9e18b36c3caeef8d1b1148eb3ee8081431997270db5e
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-2.28-patches-8.tar.xz 97384 BLAKE2B 036ab39103aa30be61fcbb46a7103cf83c1dd490eeff526444d4701b92e06a428133de2d005d65a296f14f28145f143a2386f8b17df721174a0a0b5303e99931 SHA512 29695212d8ca9c4b6d4787f4919b75cb0828ddecce65d65683b746ed23acb50e4e18419a13bb6ee4a234f44f63b38a2eebf1f1ce3d350435c2bf21d6076a97a6
+DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 4ab583be712994f949dee2512da6e12fd7f7ad73e96393f21678552b43da98f49321b53b5b009551300cdb09ca135e7f6adc636ff750c251a1d6d7f262dbc410 SHA512 e3f40ae6e9d06471c1a11bd2bce7b5161d07c3d0a81791505a72aec4817e7faf9ef09841e98c6dcf62a0a00754dff87dd194d97ac6b6354aeb2497cf60900b96
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
-DIST glibc-2.29-patches-2.tar.xz 35176 BLAKE2B a98d309686068dac5ae7eceac102610f9058e620f62661d9cd7fdbdb31608844cb254e15311ff2ac85be97bdf3d953fde625e3b088e4833c0356f6f4472f52d7 SHA512 69bbd090886942595cf47e2bdf01fc7ed8c0b8f2b7a4f8a6749b74a392a12d9cc601212cce09db434841f3740ff1a81642b8019afbdbfa8903ae4ebc5a71c801
+DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525eccfec462d638dbc25c581e5b7a2a72ffd5191842f5ac443a868cbc950838d7e5120e866d343a14b80c55dcbfa48f30 SHA512 4c9b78d9d1a8aa629418f2d758ef800857780b8a1fd8d3582b88348a513ca26ca7f6ac9110a8c6bae16949b360ba36840d184f42293cd4324760273592d1b438
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-9999-patches-11.tar.xz 17804 BLAKE2B cb4ef9fbaf0da3e2307c468d2a6731ff2475f6ebc490f0ca43d375b59aa669bec1ad0580775306adb95e249e9641bed910310185e5dced66a491c1491b99a747 SHA512 d2fced779807c7f492c17958cf4f95273d1bdcfe062bd71546f2360f3d4742a696ec8d04d984ec560c0fcccea332446834ae2c9d28cfd9009ffd091c1084edc9

diff --git a/sys-libs/glibc/glibc-2.29-r1.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
similarity index 99%
copy from sys-libs/glibc/glibc-2.29-r1.ebuild
copy to sys-libs/glibc/glibc-2.28-r6.ebuild
index 34fad50ec4f..3a0ff9b6e8b 100644
--- a/sys-libs/glibc/glibc-2.29-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -3,9 +3,7 @@
 
 EAPI=6
 
-PYTHON_COMPAT=( python3_{4,5,6,7} )
-
-inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
+inherit prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"
@@ -20,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	#KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 
@@ -29,7 +27,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=2
+PATCH_VER=9
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
@@ -74,7 +72,6 @@ COMMON_DEPEND="
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
-	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
 	!<sys-apps/sandbox-1.6
@@ -735,6 +732,9 @@ src_unpack() {
 		unpack ${P}.tar.xz
 	fi
 
+	cd "${S}" || die
+	touch locale/C-translit.h || die #185476 #218003
+
 	cd "${WORKDIR}" || die
 	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
 }

diff --git a/sys-libs/glibc/glibc-2.29-r1.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.29-r1.ebuild
rename to sys-libs/glibc/glibc-2.29-r2.ebuild
index 34fad50ec4f..e675e2b5c14 100644
--- a/sys-libs/glibc/glibc-2.29-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -29,7 +29,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=2
+PATCH_VER=3
 
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-04-08  2:18 Thomas Deutschmann
  0 siblings, 0 replies; 1076+ messages in thread
From: Thomas Deutschmann @ 2019-04-08  2:18 UTC (permalink / raw
  To: gentoo-commits

commit:     d6710f31677f77be2a509b0f01b2e104c0c7d653
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  8 02:05:16 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Apr  8 02:05:16 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d6710f31

sys-libs/glibc: x86 stable (bug #674126)

Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 sys-libs/glibc/glibc-2.28-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.28-r5.ebuild b/sys-libs/glibc/glibc-2.28-r5.ebuild
index afb24ebc97b..9907e295d98 100644
--- a/sys-libs/glibc/glibc-2.28-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r5.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc ~x86"
+	KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-04-08  6:05 Matt Turner
  0 siblings, 0 replies; 1076+ messages in thread
From: Matt Turner @ 2019-04-08  6:05 UTC (permalink / raw
  To: gentoo-commits

commit:     f65a93ad937d788319124d1267beed7049d4453f
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  8 06:02:14 2019 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Mon Apr  8 06:05:29 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f65a93ad

sys-libs/glibc-2.28-r5: alpha stable, bug 674126

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 sys-libs/glibc/glibc-2.28-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.28-r5.ebuild b/sys-libs/glibc/glibc-2.28-r5.ebuild
index 9907e295d98..947e19e868e 100644
--- a/sys-libs/glibc/glibc-2.28-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r5.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
+	KEYWORDS="alpha amd64 arm ~arm64 ~hppa ~ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-04-08 16:03 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-04-08 16:03 UTC (permalink / raw
  To: gentoo-commits

commit:     e5d372702d5b5ac6170e39ebc5c2bec7606e104a
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  8 16:02:10 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Apr  8 16:03:18 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5d37270

sys-libs/glibc: Forward keywords (including stable) to 2.28-r6

Bug: https://bugs.gentoo.org/674126
Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.28-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index 3a0ff9b6e8b..8b515a70e87 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	#KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc ~x86"
+	KEYWORDS="alpha amd64 arm ~arm64 ~hppa ~ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-04-08 16:07 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-04-08 16:07 UTC (permalink / raw
  To: gentoo-commits

commit:     cbdaaf926b791862035ad9caa58b1acecaf456f8
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  8 16:07:07 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Apr  8 16:07:23 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cbdaaf92

sys-libs/glibc: Remove 2.28-r5 to prevent messed-up keywords

Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.28-r5.ebuild | 1418 -----------------------------------
 2 files changed, 1419 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 1aa277b0a0c..94189ff713a 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,7 +16,6 @@ DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b
 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
 DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07c1edb24c3edaa1e0243b846b3832a40af1ba3a7b77aef04c54a173388156b464ea442fa8310a02e6f44e2ed5b78994286 SHA512 12496e9b0c60630dbec4c2febdd6d20df1f3d7a2c243cc55b595202b27f682b9208e16cd8c387687c0cc9e18b36c3caeef8d1b1148eb3ee8081431997270db5e
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
-DIST glibc-2.28-patches-8.tar.xz 97384 BLAKE2B 036ab39103aa30be61fcbb46a7103cf83c1dd490eeff526444d4701b92e06a428133de2d005d65a296f14f28145f143a2386f8b17df721174a0a0b5303e99931 SHA512 29695212d8ca9c4b6d4787f4919b75cb0828ddecce65d65683b746ed23acb50e4e18419a13bb6ee4a234f44f63b38a2eebf1f1ce3d350435c2bf21d6076a97a6
 DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 4ab583be712994f949dee2512da6e12fd7f7ad73e96393f21678552b43da98f49321b53b5b009551300cdb09ca135e7f6adc636ff750c251a1d6d7f262dbc410 SHA512 e3f40ae6e9d06471c1a11bd2bce7b5161d07c3d0a81791505a72aec4817e7faf9ef09841e98c6dcf62a0a00754dff87dd194d97ac6b6354aeb2497cf60900b96
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525eccfec462d638dbc25c581e5b7a2a72ffd5191842f5ac443a868cbc950838d7e5120e866d343a14b80c55dcbfa48f30 SHA512 4c9b78d9d1a8aa629418f2d758ef800857780b8a1fd8d3582b88348a513ca26ca7f6ac9110a8c6bae16949b360ba36840d184f42293cd4324760273592d1b438

diff --git a/sys-libs/glibc/glibc-2.28-r5.ebuild b/sys-libs/glibc/glibc-2.28-r5.ebuild
deleted file mode 100644
index 947e19e868e..00000000000
--- a/sys-libs/glibc/glibc-2.28-r5.ebuild
+++ /dev/null
@@ -1,1418 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="alpha amd64 arm ~arm64 ~hppa ~ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=8
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-		virtual/os-headers
-	"
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}" || die
-	touch locale/C-translit.h || die #185476 #218003
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all no) )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-		locale_list="${root}/usr/share/i18n/SUPPORTED"
-	fi
-
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-04-10 14:45 Aaron Bauman
  0 siblings, 0 replies; 1076+ messages in thread
From: Aaron Bauman @ 2019-04-10 14:45 UTC (permalink / raw
  To: gentoo-commits

commit:     09d9ddb6843020fdbc948ffb6068a01252454a66
Author:     Aaron Bauman <bman <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 10 14:41:48 2019 +0000
Commit:     Aaron Bauman <bman <AT> gentoo <DOT> org>
CommitDate: Wed Apr 10 14:45:19 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=09d9ddb6

sys-libs/glibc: arm64 stable (bug #674126)

Signed-off-by: Aaron Bauman <bman <AT> gentoo.org>
Package-Manager: Portage-2.3.62, Repoman-2.3.11

 sys-libs/glibc/glibc-2.28-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index 8b515a70e87..632b6cdb92b 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 arm ~arm64 ~hppa ~ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 ~hppa ~ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-04-13 16:14 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-04-13 16:14 UTC (permalink / raw
  To: gentoo-commits

commit:     f99af4631f3251f9e10cbd048ab8638e027fe1b2
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 13 16:08:52 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Apr 13 16:13:40 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f99af463

sys-libs/glibc: python pkg_setup fails during bootstrap.

Glibc-2.29 introduces a new python dependency for building. However,
during Prefix bootstrap, glibc has to be built before python.  The
dependency circle is broken by disabling pkg_setup() of
python-any-r1.eclass.

Bug: https://bugs.gentoo.org/682570
Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 4 ++++
 sys-libs/glibc/glibc-9999.ebuild    | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index e675e2b5c14..0e1db7e3c85 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -719,6 +719,10 @@ pkg_pretend() {
 	sanity_prechecks
 }
 
+pkg_setup() {
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
 # src_unpack
 
 src_unpack() {

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 478b5e5c9dc..ba1d5041cb7 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -720,6 +720,10 @@ pkg_pretend() {
 	sanity_prechecks
 }
 
+pkg_setup() {
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
 # src_unpack
 
 src_unpack() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-04-13 22:13 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-04-13 22:13 UTC (permalink / raw
  To: gentoo-commits

commit:     a86c7b238baf5d0bda9224f4a6bedc78ac93a0a3
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 13 22:13:07 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Apr 13 22:13:27 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a86c7b23

sys-libs/glibc: add static-libs useflag

Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ba1d5041cb7..939fdcf0e14 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -35,7 +35,7 @@ PATCH_VER=11
 SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
+IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -1331,6 +1331,12 @@ src_install() {
 	fi
 
 	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+
 	src_strip
 }
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-04-14 14:39 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-04-14 14:39 UTC (permalink / raw
  To: gentoo-commits

commit:     21a7049785f925d5deab48694c3b759aa89858e3
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 14 14:35:50 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Apr 14 14:38:49 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=21a70497

sys-libs/glibc: Add bug number comment

Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 1 +
 sys-libs/glibc/glibc-9999.ebuild    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 0e1db7e3c85..d98e7bee8e0 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -720,6 +720,7 @@ pkg_pretend() {
 }
 
 pkg_setup() {
+	# see bug 682570
 	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
 }
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 939fdcf0e14..b5a01c5590f 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -721,6 +721,7 @@ pkg_pretend() {
 }
 
 pkg_setup() {
+	# see bug 682570
 	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
 }
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-04-18 23:45 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-04-18 23:45 UTC (permalink / raw
  To: gentoo-commits

commit:     08ac6a89ea72d4cdcb02383410b58e76e69913a4
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 18 23:44:46 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Apr 18 23:45:11 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=08ac6a89

sys-libs/glibc: Fix headers-only cross-build for riscv

Package-Manager: Portage-2.3.63, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 37 ++++++++++++++++++-------------------
 sys-libs/glibc/glibc-9999.ebuild    | 37 ++++++++++++++++++-------------------
 2 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 093ffc207eb..fe9feab7f75 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -1006,25 +1006,6 @@ glibc_headers_configure() {
 		popd >/dev/null
 	fi
 
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
 	local myconf=()
 	myconf+=(
 		--disable-sanity-checks
@@ -1042,6 +1023,24 @@ glibc_headers_configure() {
 	# Nothing is compiled here which would affect the headers for the target.
 	# So forcing CC/CFLAGS is sane.
 	local headers_only_CC=$(tc-getBUILD_CC)
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		# It's not sufficient to shove the flags into CPPFLAGS, they need
+		# to really go *everywhere*.
+		headers_only_CC="${headers_only_CC} -D__riscv_xlen=64 -D__riscv_flen=64 -D__riscv_float_abi_double=1 -D__riscv_atomic=1"
+		;;
+	esac
+
 	local headers_only_CFLAGS="-O1 -pipe"
 	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
 	local headers_only_LDFLAGS=""

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 142153734f9..20846e05faf 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1007,25 +1007,6 @@ glibc_headers_configure() {
 		popd >/dev/null
 	fi
 
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
 	local myconf=()
 	myconf+=(
 		--disable-sanity-checks
@@ -1043,6 +1024,24 @@ glibc_headers_configure() {
 	# Nothing is compiled here which would affect the headers for the target.
 	# So forcing CC/CFLAGS is sane.
 	local headers_only_CC=$(tc-getBUILD_CC)
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		# It's not sufficient to shove the flags into CPPFLAGS, they need
+		# to really go *everywhere*.
+		headers_only_CC="${headers_only_CC} -D__riscv_xlen=64 -D__riscv_flen=64 -D__riscv_float_abi_double=1 -D__riscv_atomic=1"
+		;;
+	esac
+
 	local headers_only_CFLAGS="-O1 -pipe"
 	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
 	local headers_only_LDFLAGS=""


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-04-19  0:01 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-04-19  0:01 UTC (permalink / raw
  To: gentoo-commits

commit:     4b4f4514202b682d5361da627e6c317f8acc9907
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 18 23:59:29 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Apr 19 00:01:25 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4b4f4514

Revert "sys-libs/glibc: Fix headers-only cross-build for riscv"

Sergei's solution is way better. Tomorrow.
This reverts commit 08ac6a89ea72d4cdcb02383410b58e76e69913a4.

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 37 +++++++++++++++++++------------------
 sys-libs/glibc/glibc-9999.ebuild    | 37 +++++++++++++++++++------------------
 2 files changed, 38 insertions(+), 36 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index fe9feab7f75..093ffc207eb 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -1006,6 +1006,25 @@ glibc_headers_configure() {
 		popd >/dev/null
 	fi
 
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
 	local myconf=()
 	myconf+=(
 		--disable-sanity-checks
@@ -1023,24 +1042,6 @@ glibc_headers_configure() {
 	# Nothing is compiled here which would affect the headers for the target.
 	# So forcing CC/CFLAGS is sane.
 	local headers_only_CC=$(tc-getBUILD_CC)
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		# It's not sufficient to shove the flags into CPPFLAGS, they need
-		# to really go *everywhere*.
-		headers_only_CC="${headers_only_CC} -D__riscv_xlen=64 -D__riscv_flen=64 -D__riscv_float_abi_double=1 -D__riscv_atomic=1"
-		;;
-	esac
-
 	local headers_only_CFLAGS="-O1 -pipe"
 	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
 	local headers_only_LDFLAGS=""

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 20846e05faf..142153734f9 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1007,6 +1007,25 @@ glibc_headers_configure() {
 		popd >/dev/null
 	fi
 
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
 	local myconf=()
 	myconf+=(
 		--disable-sanity-checks
@@ -1024,24 +1043,6 @@ glibc_headers_configure() {
 	# Nothing is compiled here which would affect the headers for the target.
 	# So forcing CC/CFLAGS is sane.
 	local headers_only_CC=$(tc-getBUILD_CC)
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		# It's not sufficient to shove the flags into CPPFLAGS, they need
-		# to really go *everywhere*.
-		headers_only_CC="${headers_only_CC} -D__riscv_xlen=64 -D__riscv_flen=64 -D__riscv_float_abi_double=1 -D__riscv_atomic=1"
-		;;
-	esac
-
 	local headers_only_CFLAGS="-O1 -pipe"
 	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
 	local headers_only_LDFLAGS=""


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-04-19  7:35 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-04-19  7:35 UTC (permalink / raw
  To: gentoo-commits

commit:     15fbfc075d699e498d73701b6f2a3f62d7dcabba
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 19 07:32:12 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Apr 19 07:35:38 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15fbfc07

sys-libs/glibc: disable c++ detection for cross-case, bug #683074

https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=561b0bec4448f0302cb4915bf67c919bde4a1c57
in unstream glibc repo added optional dependency on CXX compiler.

Unfortunately ./configure tries hard to pass some g++ as CXX:
either ${CTARGET}-g++ (ok) or ${CBUILD}+g++ (bad).

During toolchain bootstrap ${CTARGET}-g++ does not yet exist
as we only have stage1-gcc without c++ (or libc) support.

To restore toolchain bootstrap we force-disable c++ detection
by setting cache variable:
    libc_cv_cxx_link_ok=no

c++ is force disables only for cross-compilation case
(CHOST != CTARGET). Cross-building case (CHOST = CTRAGET)
is unchanged as we should already have c++ capable toolchain
by then.

Reported-by: hanetzer <AT> startmail.com
Reported-by: rhn
Closes: https://bugs.gentoo.org/683074
Package-Manager: Portage-2.3.63, Repoman-2.3.12
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 11 +++++++++++
 sys-libs/glibc/glibc-9999.ebuild    | 11 +++++++++++
 2 files changed, 22 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 093ffc207eb..8f920eb85ac 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -799,6 +799,17 @@ glibc_do_configure() {
 
 	# 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}"
 
 	echo

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 142153734f9..b01dc823635 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -800,6 +800,17 @@ glibc_do_configure() {
 
 	# 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}"
 
 	echo


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-04-21 19:06 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-04-21 19:06 UTC (permalink / raw
  To: gentoo-commits

commit:     fedcbfbed423e21c79c2088f3776e918473fd814
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 19:05:35 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 19:06:05 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fedcbfbe

sys-libs/glibc: Add small locale install hack for riscv

Package-Manager: Portage-2.3.63, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 11 +++++++++++
 sys-libs/glibc/glibc-9999.ebuild    | 11 +++++++++++
 2 files changed, 22 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 8f920eb85ac..c0f14491fe7 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -1262,6 +1262,17 @@ glibc_do_src_install() {
 		fi
 	done
 
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
 	cd "${S}"
 
 	# Install misc network config files

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index b01dc823635..4951020d519 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1263,6 +1263,17 @@ glibc_do_src_install() {
 		fi
 	done
 
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
 	cd "${S}"
 
 	# Install misc network config files


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-04-23 22:05 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-04-23 22:05 UTC (permalink / raw
  To: gentoo-commits

commit:     3fb59ae860a9cd5cdd34b5c63fa006b7025a4604
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 23 22:04:53 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Apr 23 22:05:20 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3fb59ae8

sys-libs/glibc: Add riscv dynamic linker locations

Package-Manager: Portage-2.3.64, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 3 +++
 sys-libs/glibc/glibc-9999.ebuild    | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index c0f14491fe7..60641cf7a5d 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -1180,6 +1180,9 @@ glibc_do_src_install() {
 		# powerpc
 		ppc     /lib/ld.so.1
 		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
 		# s390
 		s390    /lib/ld.so.1
 		s390x   /lib/ld64.so.1

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 4951020d519..3655b03320f 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1181,6 +1181,9 @@ glibc_do_src_install() {
 		# powerpc
 		ppc     /lib/ld.so.1
 		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
 		# s390
 		s390    /lib/ld.so.1
 		s390x   /lib/ld64.so.1


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-04-27 20:50 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-04-27 20:50 UTC (permalink / raw
  To: gentoo-commits

commit:     6326905eb8cef4c72e900fcbfb5c4032624b61c2
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 27 20:49:43 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Apr 27 20:50:37 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6326905e

sys-libs/glibc: stable 2.28-r6 for ia64, bug #674126

Package-Manager: Portage-2.3.65, Repoman-2.3.12
RepoMan-Options: --include-arches="ia64"
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.28-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index 632b6cdb92b..601386fafaf 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 arm arm64 ~hppa ~ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-05-01  6:22 Matt Turner
  0 siblings, 0 replies; 1076+ messages in thread
From: Matt Turner @ 2019-05-01  6:22 UTC (permalink / raw
  To: gentoo-commits

commit:     7deb3ed5ccf8ea2c38e6e7cf2c8edbb3d93cc3ff
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Wed May  1 06:22:01 2019 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Wed May  1 06:22:13 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7deb3ed5

sys-libs/glibc-2.28-r6: ppc stable, bug 674126

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 sys-libs/glibc/glibc-2.28-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index 601386fafaf..c843db7e2db 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 m68k ~mips ppc ~ppc64 s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-05-01  6:22 Matt Turner
  0 siblings, 0 replies; 1076+ messages in thread
From: Matt Turner @ 2019-05-01  6:22 UTC (permalink / raw
  To: gentoo-commits

commit:     f78eb8cb5aa242e1b3ac9fe5e7e77a814ff23222
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Wed May  1 06:22:02 2019 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Wed May  1 06:22:14 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f78eb8cb

sys-libs/glibc-2.28-r6: ppc64 stable, bug 674126

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 sys-libs/glibc/glibc-2.28-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index c843db7e2db..55793d8cbe2 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 m68k ~mips ppc ~ppc64 s390 sh sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-05-01 18:46 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-05-01 18:46 UTC (permalink / raw
  To: gentoo-commits

commit:     64045b6b9bfc70542981af55765f0e931e3a90f1
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed May  1 18:46:34 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed May  1 18:46:34 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=64045b6b

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.64, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |   2 -
 sys-libs/glibc/glibc-2.22-r4.ebuild | 148 ------------------------------------
 2 files changed, 150 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 49cc077e29f..9b881cd1c83 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -2,8 +2,6 @@ DIST gcc-4.7.3-r1-multilib-bootstrap.tar.bz2 8064097 BLAKE2B 3cc5c82cd57d0fbd26d
 DIST gcc-multilib-bootstrap-20180511.tar.xz 2392908 BLAKE2B f3cf614399368acd8908f60d894c6344a2fa09383b30c1633a0682bc668367c8a2f8c6fec2d41b6e2178d709a2bd8db57e8b2ab56ba263c7d56f819c15acd061 SHA512 98c766e913693ab42ff790557acde2a36a8001e2648046a685b21964200df8d4d52d8452d499c0068c6648284d086ce062c2d36e2c6c2fd8aacd232d193f2853
 DIST glibc-2.19-patches-9.tar.bz2 24584 BLAKE2B a96e930a5bd20fa75d9f259cc2117fa5ce98072274a24a5823bf877e3739fa4c001a94d7865e065ee0527f3974430d27da8038e042340a451ad2052c62724f26 SHA512 a95b3063ade974a3556480b798b317d33c7423a8cb9e69f67249ffb8b3d3c671d70d2d5f782c1efadc0bec4cc49a96d4fe89911f3dfcd85b459f69f3b4f38f0e
 DIST glibc-2.19.tar.xz 12083312 BLAKE2B 9dc03346e0f0df4bf009a92d894b0a9f964ff92b7f4c9663cedf1cb6cf90435f28a15539d33791ecf43ee578fa4e26f916af0367651312ef8f9c1c38ce0dafa2 SHA512 9e021fcb3afbb9ace2a0e37fded231a62de861bd766e29d47163a03182e37add718b7acc3963d1c525f9556773e842297725715acde48dcfbaab6e756af1a23d
-DIST glibc-2.22-patches-13.tar.bz2 74479 BLAKE2B 1ab31614e8334508a63c842f503a395ff3ebeaa33d1890eab1d9e2985cb39064960053f2bbf99ec3bdec0ba5a80d259ca6b964fcaed9d99dcb6da84ddb8dd364 SHA512 73517fc1502b0733d67ade1d1ba6168415f5da64f37045fac0b10ef57155bf6dfbe1876e4742d2543fcea0c935c179426f6fbb94f0205968392ef903d2f83897
-DIST glibc-2.22.tar.xz 12969072 BLAKE2B 36a2e08cf4c5c9396c414fcf5cf5f32d0a78a61e06a1309fbc5f560bed7a7f25a084f5f5c1097014d0911239c710ac9c06f6b6d603238b9c928dd286ebd05bbf SHA512 a8719f3a4f8aa5fa81711116fdafbea5082c6dfd85bd8c4cdce60571910263ab422b35bb8b55a84d37ccb146442133ba60a84d453ca4a439c8ccd35419bd051b
 DIST glibc-2.23-patches-8.tar.bz2 304199 BLAKE2B 693e40090dbe43f0e9c1faa0bce75e43d5d3924b40c141f9d00ef147fd285b03e2c3bab6a32d1bf6978ca139c3f071f685d5caf1bffb1cce7e1d1f3c346e5c50 SHA512 470814bbbd9d4ee5fa2dd7570a2e14b0229723e373e801472856fd6c2f089499eddc300f69b49af8ba0edbdca583ee3ca521fdb5c642509717cafea0ad925fd2
 DIST glibc-2.23.tar.xz 13455260 BLAKE2B 6658e9d2d07c5cd71be94ef399bfe4d18ef462e4154e2e02aa69c34198e881cc65ac8f89abcb37b3d01c56b10e2f47c036492c20e4991a54bd03e56db703fbd2 SHA512 b82953388cd028e174cb08f082557bbce0dad8b67b17d31b29f90102fd52a51e03d591448ecb64882a1c1d5303afffc7f6ede85cee4c784a9284fbc9b4ad26cf
 DIST glibc-2.24-patches-10.tar.bz2 73586 BLAKE2B f42cc78b907e7cb5c8ba1672c845cdc0959f4d29f89ff642bd2efa795d7ac69409b514338ac1f4235ce2fbc0c9c9bb2d152f55fd14c02997517dc048a306e1c1 SHA512 fc9191a85da53a2515bbaab228648936682e04267284049468e0c82284f618ab2907b9247baca701e16edc50640199ff6d8e2a6a93ccbd5a9d3b0eb73cc484ca

diff --git a/sys-libs/glibc/glibc-2.22-r4.ebuild b/sys-libs/glibc/glibc-2.22-r4.ebuild
deleted file mode 100644
index d6b644dd754..00000000000
--- a/sys-libs/glibc/glibc-2.22-r4.ebuild
+++ /dev/null
@@ -1,148 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="4"
-
-inherit toolchain-glibc
-
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
-RESTRICT="strip" # strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-RELEASE_VER=""
-case ${PV} in
-9999*)
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	inherit git-r3
-	;;
-*)
-	RELEASE_VER=${PV}
-	;;
-esac
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-PATCH_VER="13"                                 # Gentoo patchset
-: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
-
-IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-DEPEND=">=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	selinux? ( sys-libs/libselinux )"
-RDEPEND="!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	selinux? ( sys-libs/libselinux )
-	!sys-libs/nss-db"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.6
-		virtual/os-headers"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
-}
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
-
-src_unpack() {
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-	# Bug 558636 we don't apply the pie works around for 2.22. It shoud have the support. #558636
-	GLIBC_PATCH_EXCLUDE+=" 00_all_0002-workaround-crash-when-handling-signals-in-static-PIE.patch"
-	GLIBC_PATCH_EXCLUDE+=" 00_all_0012-disable-PIE-when-checking-for-PIC-default.patch"
-
-	toolchain-glibc_src_unpack
-}
-
-src_prepare() {
-	toolchain-glibc_src_prepare
-
-	cd "${S}"
-
-	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-
-		# Build various bits with ssp-all
-		sed -i \
-			-e 's:-fstack-protector$:-fstack-protector-all:' \
-			*/Makefile || die
-	fi
-
-	case $(gcc-fullversion) in
-	4.8.[0-3]|4.9.0)
-		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
-		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
-		die "need to switch compilers #547420"
-		;;
-	esac
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-05-02 15:31 Matt Turner
  0 siblings, 0 replies; 1076+ messages in thread
From: Matt Turner @ 2019-05-02 15:31 UTC (permalink / raw
  To: gentoo-commits

commit:     d73cb0ddca7b0acbb8e3b7ccdeedb4794d90ba08
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Thu May  2 15:30:44 2019 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu May  2 15:30:54 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d73cb0dd

sys-libs/glibc-2.28-r6: hppa stable, bug 674126

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 sys-libs/glibc/glibc-2.28-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index 55793d8cbe2..e92fe7e72e6 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-05-03 21:49 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-05-03 21:49 UTC (permalink / raw
  To: gentoo-commits

commit:     3172cab41ff652c007937dfec7f4643f8beb26b9
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed May  1 22:17:07 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri May  3 21:43:57 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3172cab4

sys-libs/glibc: Keyword ~riscv

Package-Manager: Portage-2.3.64, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 60641cf7a5d..f65ca48ab82 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -20,7 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-05-13 12:08 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2019-05-13 12:08 UTC (permalink / raw
  To: gentoo-commits

commit:     b3ad265998a04a40820d078d25c06b7cb51173ef
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Mon May 13 12:07:25 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Mon May 13 12:08:38 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b3ad2659

sys-libs/glibc: amd64 stable wrt bug #685818

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>
Package-Manager: Portage-2.3.62, Repoman-2.3.11
RepoMan-Options: --include-arches="amd64"

 sys-libs/glibc/glibc-2.29-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index f65ca48ab82..1d9c4780d28 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -20,7 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-05-13 19:14 Aaron Bauman
  0 siblings, 0 replies; 1076+ messages in thread
From: Aaron Bauman @ 2019-05-13 19:14 UTC (permalink / raw
  To: gentoo-commits

commit:     9e06c1242e104b66a532e7d5d919c1b3b1f8343d
Author:     Aaron Bauman <bman <AT> gentoo <DOT> org>
AuthorDate: Mon May 13 19:13:41 2019 +0000
Commit:     Aaron Bauman <bman <AT> gentoo <DOT> org>
CommitDate: Mon May 13 19:13:41 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9e06c124

sys-libs/glibc: arm64 stable (bug #685818)

Signed-off-by: Aaron Bauman <bman <AT> gentoo.org>
Package-Manager: Portage-2.3.66, Repoman-2.3.12
RepoMan-Options: --include-arches="arm64"

 sys-libs/glibc/glibc-2.29-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 1d9c4780d28..673896091c7 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -20,7 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-05-16 23:56 Thomas Deutschmann
  0 siblings, 0 replies; 1076+ messages in thread
From: Thomas Deutschmann @ 2019-05-16 23:56 UTC (permalink / raw
  To: gentoo-commits

commit:     332fc91e3e72a6dd1b183ce4a19d08b45daa8e00
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Thu May 16 23:36:57 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Thu May 16 23:36:57 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=332fc91e

sys-libs/glibc: x86 stable (bug #685818)

Package-Manager: Portage-2.3.66, Repoman-2.3.12
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 673896091c7..5719cbbf6f7 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -20,7 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-05-19  8:39 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-05-19  8:39 UTC (permalink / raw
  To: gentoo-commits

commit:     5a00ffa513c9cc38af9a6c573005521fada0b6d7
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun May 19 08:33:27 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun May 19 08:39:48 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a00ffa5

sys-libs/glibc: drop obsolete -fno-strict-aliasing, bug #686018

Reported-and-tested-by: Jan Fikar
Bug: https://bugs.gentoo.org/686018
Package-Manager: Portage-2.3.66, Repoman-2.3.12
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 3655b03320f..e39fd36b2f0 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -372,9 +372,8 @@ setup_flags() {
 	fi
 
 	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
 	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
+	append-flags -O2
 
 	filter-flags '-fstack-protector*'
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-05-19  9:15 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-05-19  9:15 UTC (permalink / raw
  To: gentoo-commits

commit:     9ecb3b089082f39a15c4c1a315ed91b388a80ade
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun May 19 09:15:02 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun May 19 09:15:02 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9ecb3b08

sys-libs/glibc: add USE=custom-cflags, bug #686018

Allow users to pass in more (or less) aggressive CFLAGS for
USE=custom-cflags case (disabled by default).

Reported-and-tested-by:Jan Fikar
Bug: https://bugs.gentoo.org/686018
Package-Manager: Portage-2.3.66, Repoman-2.3.12
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index e39fd36b2f0..6d310a66d32 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -35,7 +35,7 @@ PATCH_VER=11
 SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+IUSE="audit caps cet compile-locales custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -345,11 +345,18 @@ setup_flags() {
 	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
 	ASFLAGS=${ASFLAGS_BASE}
 
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
 	strip-unsupported-flags
 	filter-flags -m32 -m64 '-mabi=*'
 
@@ -371,9 +378,9 @@ setup_flags() {
 		CBUILD_OPT=${CTARGET_OPT}
 	fi
 
-	# Lock glibc at -O2; we want to be conservative here.
-	filter-flags '-O?'
-	append-flags -O2
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
 
 	filter-flags '-fstack-protector*'
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-05-19  9:37 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-05-19  9:37 UTC (permalink / raw
  To: gentoo-commits

commit:     060b7e2889c2cd108a10185e85e9b342d394dedf
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun May 19 09:37:27 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun May 19 09:37:27 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=060b7e28

sys-libs/glibc: refresh live ebuild patchset

Package-Manager: Portage-2.3.66, Repoman-2.3.12
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 9b881cd1c83..9c53d323751 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,4 +16,4 @@ DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 4ab583be712994f949dee2512da6e12fd
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525eccfec462d638dbc25c581e5b7a2a72ffd5191842f5ac443a868cbc950838d7e5120e866d343a14b80c55dcbfa48f30 SHA512 4c9b78d9d1a8aa629418f2d758ef800857780b8a1fd8d3582b88348a513ca26ca7f6ac9110a8c6bae16949b360ba36840d184f42293cd4324760273592d1b438
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
-DIST glibc-9999-patches-11.tar.xz 17804 BLAKE2B cb4ef9fbaf0da3e2307c468d2a6731ff2475f6ebc490f0ca43d375b59aa669bec1ad0580775306adb95e249e9641bed910310185e5dced66a491c1491b99a747 SHA512 d2fced779807c7f492c17958cf4f95273d1bdcfe062bd71546f2360f3d4742a696ec8d04d984ec560c0fcccea332446834ae2c9d28cfd9009ffd091c1084edc9
+DIST glibc-9999-patches-12.tar.xz 17652 BLAKE2B 25a35eced3816dad02521b03f291292158e0c2f7c19aa416074d88ec719df9913b2d1e7e225a888a7b1f2455fc476c930f8e4b963d2439a2ba982ee038ce798b SHA512 4e985100441e761c50d76ee591924d4ed8284e55b186738c1a40001422c2382cdcfa46ac35f747897861a80045f2b92a0cd4639cd603372227d164c47460762a

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 6d310a66d32..da0584e4b07 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -30,7 +30,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=11
+PATCH_VER=12
 
 SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-05-23 13:13 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2019-05-23 13:13 UTC (permalink / raw
  To: gentoo-commits

commit:     745b07e84b5035576737d3e1a719121d02e53feb
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Thu May 23 13:12:58 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Thu May 23 13:12:58 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=745b07e8

sys-libs/glibc: arm stable wrt bug #685818

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>
Package-Manager: Portage-2.3.62, Repoman-2.3.11
RepoMan-Options: --include-arches="arm"

 sys-libs/glibc/glibc-2.29-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 5719cbbf6f7..e99e6b51c50 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -20,7 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-05-27 10:08 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2019-05-27 10:08 UTC (permalink / raw
  To: gentoo-commits

commit:     52355459ec00b9ca9921bd5f788bad9b95346910
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Mon May 27 10:08:11 2019 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Mon May 27 10:08:11 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=52355459

sys-libs/glibc: ppc stable wrt bug #685818

Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>
Package-Manager: Portage-2.3.62, Repoman-2.3.11
RepoMan-Options: --include-arches="ppc"

 sys-libs/glibc/glibc-2.29-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index e99e6b51c50..2d18531ae95 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -20,7 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-05-27 10:09 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2019-05-27 10:09 UTC (permalink / raw
  To: gentoo-commits

commit:     e56c3c1f1c0a256c228a59be94869751d7fd31d7
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Mon May 27 10:09:02 2019 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Mon May 27 10:09:02 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e56c3c1f

sys-libs/glibc: ppc64 stable wrt bug #685818

Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>
Package-Manager: Portage-2.3.62, Repoman-2.3.11
RepoMan-Options: --include-arches="ppc64"

 sys-libs/glibc/glibc-2.29-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 2d18531ae95..484ace93852 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -20,7 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sh ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-05-31  8:08 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2019-05-31  8:08 UTC (permalink / raw
  To: gentoo-commits

commit:     2ca6a4b9d647f567d2300e7b90829993d7575b41
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Fri May 31 08:08:21 2019 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Fri May 31 08:08:21 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2ca6a4b9

sys-libs/glibc: ia64 stable wrt bug #685818

Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>
Package-Manager: Portage-2.3.66, Repoman-2.3.11
RepoMan-Options: --include-arches="ia64"

 sys-libs/glibc/glibc-2.29-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 484ace93852..94b3e9b0868 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -20,7 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sh ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-06-23 14:50 Tobias Klausmann
  0 siblings, 0 replies; 1076+ messages in thread
From: Tobias Klausmann @ 2019-06-23 14:50 UTC (permalink / raw
  To: gentoo-commits

commit:     bcddad6780ead2b44528a4aa1d51107b4a225524
Author:     Tobias Klausmann <klausman <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 23 14:50:14 2019 +0000
Commit:     Tobias Klausmann <klausman <AT> gentoo <DOT> org>
CommitDate: Sun Jun 23 14:50:14 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bcddad67

sys-libs/glibc-2.29-r2: alpha stable

Bug: http://bugs.gentoo.org/685818
Signed-off-by: Tobias Klausmann <klausman <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 94b3e9b0868..1530ae9e9a3 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -20,7 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sh ~sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-07-18  4:08 Benda XU
  0 siblings, 0 replies; 1076+ messages in thread
From: Benda XU @ 2019-07-18  4:08 UTC (permalink / raw
  To: gentoo-commits

commit:     85ab472fe1870998057fcab265871539fcdc1dcf
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 17 03:00:02 2019 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Thu Jul 18 04:08:26 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=85ab472f

sys-libs/glibc: keyword ~amd64 for 2.19-r2.

  This is for Prefix on RHEL5-like hosts.

Package-Manager: Portage-2.3.69, Repoman-2.3.12
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index 496ac4d5a31..ec7aefcc4f9 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Authors
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -18,7 +18,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS=""
+	KEYWORDS="~amd64"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-07-21 13:40 James Le Cuirot
  0 siblings, 0 replies; 1076+ messages in thread
From: James Le Cuirot @ 2019-07-21 13:40 UTC (permalink / raw
  To: gentoo-commits

commit:     ea4cbdc9159c0ebbd29d4062bbb314393a8cc32f
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 12 21:13:47 2019 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sun Jul 21 13:30:54 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ea4cbdc9

sys-libs/glibc: Fix handling of ${EPREFIX} when building cross-glibc

It was duplicating the prefix in the form
${EPREFIX}/usr/${CTARGET}/${EPREFIX}.

This also fixes the kernel header version check, which was broken for
native prefixed builds.

Bug: https://bugs.gentoo.org/642604
Closes: https://github.com/gentoo/gentoo/pull/12435
Package-Manager: Portage-2.3.69, Repoman-2.3.13
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 32 ++++++++++++++++++++++----------
 sys-libs/glibc/glibc-9999.ebuild    | 32 ++++++++++++++++++++++----------
 2 files changed, 44 insertions(+), 20 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index ad6fed1c166..da78a273d19 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -125,6 +125,18 @@ alt_prefix() {
 	is_crosscompile && echo /usr/${CTARGET}
 }
 
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
 # We need to be able to set alternative headers for compiling for non-native
 # platform. Will also become useful for testing kernel-headers without screwing
 # up the whole system.
@@ -134,7 +146,7 @@ alt_headers() {
 
 alt_build_headers() {
 	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
 		if tc-is-cross-compiler ; then
 			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
 			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
@@ -578,7 +590,7 @@ eend_KV() {
 
 get_kheader_version() {
 	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
 	tail -n 1
 }
 
@@ -892,9 +904,9 @@ glibc_do_configure() {
 		$(use_enable profile)
 		$(use_with gd)
 		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
 		--libdir='$(prefix)'/$(get_libdir)
 		--mandir='$(prefix)'/share/man
 		--infodir='$(prefix)'/share/info
@@ -916,8 +928,8 @@ glibc_do_configure() {
 
 	# There is no configure option for this and we need to export it
 	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${EPREFIX}/$(get_libdir)"
+	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
@@ -1046,7 +1058,7 @@ glibc_headers_configure() {
 		--build=${CBUILD_OPT:-${CBUILD}}
 		--host=${CTARGET_OPT:-${CTARGET}}
 		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
+		--prefix="$(host_eprefix)/usr"
 		${EXTRA_ECONF}
 	)
 
@@ -1136,7 +1148,7 @@ glibc_do_src_install() {
 	local builddir=$(builddir nptl)
 	cd "${builddir}"
 
-	emake install_root="${D}$(alt_prefix)" install || die
+	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install || die
 
 	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
 	# which come without headers etc. Only needed for binary packages since the
@@ -1320,7 +1332,7 @@ glibc_do_src_install() {
 glibc_headers_install() {
 	local builddir=$(builddir "headers")
 	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
+	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
 
 	insinto $(alt_headers)/gnu
 	doins "${S}"/include/gnu/stubs.h

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 39209741d27..2b0697465d5 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -126,6 +126,18 @@ alt_prefix() {
 	is_crosscompile && echo /usr/${CTARGET}
 }
 
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
 # We need to be able to set alternative headers for compiling for non-native
 # platform. Will also become useful for testing kernel-headers without screwing
 # up the whole system.
@@ -135,7 +147,7 @@ alt_headers() {
 
 alt_build_headers() {
 	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
 		if tc-is-cross-compiler ; then
 			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
 			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
@@ -585,7 +597,7 @@ eend_KV() {
 
 get_kheader_version() {
 	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
 	tail -n 1
 }
 
@@ -899,9 +911,9 @@ glibc_do_configure() {
 		$(use_enable profile)
 		$(use_with gd)
 		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
 		--libdir='$(prefix)'/$(get_libdir)
 		--mandir='$(prefix)'/share/man
 		--infodir='$(prefix)'/share/info
@@ -923,8 +935,8 @@ glibc_do_configure() {
 
 	# There is no configure option for this and we need to export it
 	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${EPREFIX}/$(get_libdir)"
+	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
@@ -1053,7 +1065,7 @@ glibc_headers_configure() {
 		--build=${CBUILD_OPT:-${CBUILD}}
 		--host=${CTARGET_OPT:-${CTARGET}}
 		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
+		--prefix="$(host_eprefix)/usr"
 		${EXTRA_ECONF}
 	)
 
@@ -1143,7 +1155,7 @@ glibc_do_src_install() {
 	local builddir=$(builddir nptl)
 	cd "${builddir}"
 
-	emake install_root="${D}$(alt_prefix)" install || die
+	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install || die
 
 	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
 	# which come without headers etc. Only needed for binary packages since the
@@ -1327,7 +1339,7 @@ glibc_do_src_install() {
 glibc_headers_install() {
 	local builddir=$(builddir "headers")
 	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
+	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
 
 	insinto $(alt_headers)/gnu
 	doins "${S}"/include/gnu/stubs.h


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-07-23  7:14 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-07-23  7:14 UTC (permalink / raw
  To: gentoo-commits

commit:     f0835514f598eb471edd0d92dc29536afbbcb039
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 23 07:12:09 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Jul 23 07:14:33 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f0835514

sys-libs/glibc: expose a knob to downgrade glibc

It's not something to be used lightly. Useful when the damage was not
yet done to the rest of the system.

Usage example:
    # I_ALLOW_TO_BREAK_MY_SYSTEM=yes emerge -v1 "=glibc-${old-version}"

Be prepared to deal with downgrade consequences like disappeared symbols
and versions of symbols

Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index da78a273d19..313e5c6b440 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -614,7 +614,7 @@ sanity_prechecks() {
 		if has_version ">${CATEGORY}/${P}-r10000" ; then
 			eerror "Sanity check to keep you from breaking your system:"
 			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
 		fi
 
 		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2b0697465d5..0ba2efb974c 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -621,7 +621,7 @@ sanity_prechecks() {
 		if has_version ">${CATEGORY}/${P}-r10000" ; then
 			eerror "Sanity check to keep you from breaking your system:"
 			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
 		fi
 
 		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-07-25 22:32 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-07-25 22:32 UTC (permalink / raw
  To: gentoo-commits

commit:     daed4831fcde3f2144b5771e0077256d7e1df92a
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 25 22:03:50 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Jul 25 22:31:53 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=daed4831

sys-libs/glibc: fix CPPFLAGS handling, bug #686248

Main triver of the change is an early cross-compilation of glibc headers
where we provide enough CPPFLAGS for a target to parse headers.

Unfortunately preprocessor was not always taking into accound CPPFLAGS.
This change fixes it. This chould make
    'crossdev -t riscv64-unknown-linux-gnu'
just work.

Closes: https://bugs.gentoo.org/686248
Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest                            |  3 +-
 .../{glibc-9999.ebuild => glibc-2.29-r3.ebuild}    | 37 +++++++---------------
 sys-libs/glibc/glibc-9999.ebuild                   |  2 +-
 3 files changed, 15 insertions(+), 27 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 9c53d323751..741bd5a02f4 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,5 +15,6 @@ DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea
 DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 4ab583be712994f949dee2512da6e12fd7f7ad73e96393f21678552b43da98f49321b53b5b009551300cdb09ca135e7f6adc636ff750c251a1d6d7f262dbc410 SHA512 e3f40ae6e9d06471c1a11bd2bce7b5161d07c3d0a81791505a72aec4817e7faf9ef09841e98c6dcf62a0a00754dff87dd194d97ac6b6354aeb2497cf60900b96
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525eccfec462d638dbc25c581e5b7a2a72ffd5191842f5ac443a868cbc950838d7e5120e866d343a14b80c55dcbfa48f30 SHA512 4c9b78d9d1a8aa629418f2d758ef800857780b8a1fd8d3582b88348a513ca26ca7f6ac9110a8c6bae16949b360ba36840d184f42293cd4324760273592d1b438
+DIST glibc-2.29-patches-4.tar.xz 63576 BLAKE2B 4a9005326e16f8c6b9e1a38e596d66c9f8063572324bfde69c01d2eda3cb026425bcb8dc16ebfc75779e0a66d595f672501cfdafbac18a8a613b84b1d8e670ba SHA512 64b2756169444a865afb20c6fec2b4534f6ae36082cf517c882c8e5e6f7335636a8f0da1b8faf476558664da460db20f5d50f526044a4c203bd7874ecd62d945
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
-DIST glibc-9999-patches-12.tar.xz 17652 BLAKE2B 25a35eced3816dad02521b03f291292158e0c2f7c19aa416074d88ec719df9913b2d1e7e225a888a7b1f2455fc476c930f8e4b963d2439a2ba982ee038ce798b SHA512 4e985100441e761c50d76ee591924d4ed8284e55b186738c1a40001422c2382cdcfa46ac35f747897861a80045f2b92a0cd4639cd603372227d164c47460762a
+DIST glibc-9999-patches-13.tar.xz 18316 BLAKE2B c55359dda094dabfec85f53e48fcd43985d41211f29c0c3ba0d07c4ce28994f96c334c9fcc2a6b78e64123363253c701ed6e9335f4e74274c984734ac8881731 SHA512 627799f65f79e60ed3a9ba1a499d21e771f1b109934967c9fbdf3300b0c1509ef5382834e63c8ead23ffbaee80becf541da5b25e4e2cfa8f6baa801c3838c69d

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.29-r3.ebuild
similarity index 97%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.29-r3.ebuild
index 0ba2efb974c..f94b65fed35 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r3.ebuild
@@ -20,8 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 
@@ -30,12 +29,12 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=12
+PATCH_VER=4
 
 SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps cet compile-locales custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -357,18 +356,11 @@ setup_flags() {
 	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
 	ASFLAGS=${ASFLAGS_BASE}
 
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
+	# Over-zealous CFLAGS can often cause problems.  What may work for one
+	# person may not work for another.  To avoid a large influx of bugs
+	# relating to failed builds, we strip most CFLAGS out to ensure as few
+	# problems as possible.
+	strip-flags
 	strip-unsupported-flags
 	filter-flags -m32 -m64 '-mabi=*'
 
@@ -390,9 +382,10 @@ setup_flags() {
 		CBUILD_OPT=${CTARGET_OPT}
 	fi
 
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
+	# Lock glibc at -O2; we want to be conservative here.
+	# -fno-strict-aliasing is to work around #155906.
+	filter-flags '-O?'
+	append-flags -O2 -fno-strict-aliasing
 
 	filter-flags '-fstack-protector*'
 }
@@ -1375,12 +1368,6 @@ src_install() {
 	fi
 
 	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-
 	src_strip
 }
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 0ba2efb974c..0b6964c6a3b 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -30,7 +30,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=12
+PATCH_VER=13
 
 SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-07-29  9:05 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2019-07-29  9:05 UTC (permalink / raw
  To: gentoo-commits

commit:     fad52f75c759ca326ce0f8c37e227827f01cd2f1
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 29 09:04:59 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Mon Jul 29 09:04:59 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fad52f75

sys-libs/glibc: m68k stable wrt bug #685818

Package-Manager: Portage-2.3.69, Repoman-2.3.16
RepoMan-Options: --include-arches="m68k"
Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 2fcff3fddbf..a9ed33739e8 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -20,7 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sh ~sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 m68k ~mips ppc ppc64 ~riscv s390 sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-07-29  9:05 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2019-07-29  9:05 UTC (permalink / raw
  To: gentoo-commits

commit:     7b7ec9a6b3355d6111e1a449ca13e24cb6ef0295
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 29 09:04:21 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Mon Jul 29 09:04:21 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b7ec9a6

sys-libs/glibc: s390 stable wrt bug #685818

Package-Manager: Portage-2.3.69, Repoman-2.3.16
RepoMan-Options: --include-arches="s390"
Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 313e5c6b440..f89610fb2a4 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -20,7 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sh ~sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~riscv s390 ~sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-07-29  9:05 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2019-07-29  9:05 UTC (permalink / raw
  To: gentoo-commits

commit:     0fe91535a7ba382f10084def5482e61359f201cb
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 29 09:04:39 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Mon Jul 29 09:04:39 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0fe91535

sys-libs/glibc: sh stable wrt bug #685818

Package-Manager: Portage-2.3.69, Repoman-2.3.16
RepoMan-Options: --include-arches="sh"
Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index f89610fb2a4..2fcff3fddbf 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -20,7 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~riscv s390 ~sh ~sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-08-03 22:40 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-08-03 22:40 UTC (permalink / raw
  To: gentoo-commits

commit:     0c75677c624b9521e3aa897ba573761fb8d1dee8
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  3 22:37:24 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Aug  3 22:40:36 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0c75677c

sys-libs/glibc: Version bump, untested, without keywords

Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          |    2 +
 sys-libs/glibc/glibc-2.30.ebuild | 1473 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 1475 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 741bd5a02f4..fa4ab1108bb 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,4 +17,6 @@ DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79
 DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525eccfec462d638dbc25c581e5b7a2a72ffd5191842f5ac443a868cbc950838d7e5120e866d343a14b80c55dcbfa48f30 SHA512 4c9b78d9d1a8aa629418f2d758ef800857780b8a1fd8d3582b88348a513ca26ca7f6ac9110a8c6bae16949b360ba36840d184f42293cd4324760273592d1b438
 DIST glibc-2.29-patches-4.tar.xz 63576 BLAKE2B 4a9005326e16f8c6b9e1a38e596d66c9f8063572324bfde69c01d2eda3cb026425bcb8dc16ebfc75779e0a66d595f672501cfdafbac18a8a613b84b1d8e670ba SHA512 64b2756169444a865afb20c6fec2b4534f6ae36082cf517c882c8e5e6f7335636a8f0da1b8faf476558664da460db20f5d50f526044a4c203bd7874ecd62d945
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
+DIST glibc-2.30-patches-1.tar.xz 19364 BLAKE2B 853ae651cf48a78796ac0a3c9c84098731d5a43b37644ee5029d2e2b06dab0d1d96b9dd7c3fd896c5513f5f712beca13845c1e24c698fe824ce0f529a2a827d4 SHA512 23065ec67b1a6302eece79da1ba731aa158a2abc0c65aed755cafea388c19aa1f545a6ea6d9db1fd128d06c6878b4c73aea07c6acc053b56bc416143e96e1c05
+DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-9999-patches-13.tar.xz 18316 BLAKE2B c55359dda094dabfec85f53e48fcd43985d41211f29c0c3ba0d07c4ce28994f96c334c9fcc2a6b78e64123363253c701ed6e9335f4e74274c984734ac8881731 SHA512 627799f65f79e60ed3a9ba1a499d21e771f1b109934967c9fbdf3300b0c1509ef5382834e63c8ead23ffbaee80becf541da5b25e4e2cfa8f6baa801c3838c69d

diff --git a/sys-libs/glibc/glibc-2.30.ebuild b/sys-libs/glibc/glibc-2.30.ebuild
new file mode 100644
index 00000000000..6743802aea0
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.30.ebuild
@@ -0,0 +1,1473 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python3_{5,6,7} )
+
+inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=1
+
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+	!sys-kernel/ps3-sources
+	!sys-libs/nss-db
+"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+		virtual/os-headers
+	"
+	RDEPEND+="
+		>=net-dns/libidn2-2.0.5
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake -s glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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' 2>/dev/null ; then
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		amd64)
+			# -march needed for #185404 #199334
+			# Note: This test only matters when the x86 ABI is enabled, so we could
+			# optimize a bit and elide it.
+			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparc64v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparcv9v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ ${ROOT} != "/" ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ ${ROOT} == "/" ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=$(usex ssp all no) )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local locale_list="${root}/etc/locale.gen"
+	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+		locale_list="${root}/usr/share/i18n/SUPPORTED"
+	fi
+
+	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install || die
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen "${ED}"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_strip() {
+	# gdb is lame and requires some debugging information to remain in
+	# libpthread, so we need to strip it by hand.  libthread_db makes no
+	# sense stripped as it is only used when debugging.
+	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
+	env \
+		-uRESTRICT \
+		CHOST=${CTARGET} \
+		STRIP_MASK="/*/{,tls/}${pthread}*" \
+		prepallstrip
+	# if user has stripping enabled and does not have split debug turned on,
+	# then leave the debugging sections in libpthread.
+	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
+		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
+	fi
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+
+	src_strip
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ ${ROOT} != "/" ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+	fi
+
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		use compile-locales || run_locale_gen "${EROOT}"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-08-03 22:45 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-08-03 22:45 UTC (permalink / raw
  To: gentoo-commits

commit:     124591d3e0c9579953b81ad8706b233177f0e95b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  3 22:45:06 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Aug  3 22:45:06 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=124591d3

sys-libs/glibc: Complete compile-locale handling, hopefully

Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30.ebuild | 6 ++++++
 sys-libs/glibc/glibc-9999.ebuild | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.30.ebuild b/sys-libs/glibc/glibc-2.30.ebuild
index 6743802aea0..2d1e13c28ac 100644
--- a/sys-libs/glibc/glibc-2.30.ebuild
+++ b/sys-libs/glibc/glibc-2.30.ebuild
@@ -1142,6 +1142,9 @@ run_locale_gen() {
 	# if the host locales.gen contains no entries, we'll install everything
 	local root="$1"
 	local locale_list="${root}/etc/locale.gen"
+
+	pushd "${ED}"/$(get_libdir)
+
 	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
 		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
 		locale_list="${root}/usr/share/i18n/SUPPORTED"
@@ -1149,6 +1152,8 @@ run_locale_gen() {
 
 	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
 		--destdir "${root}"
+
+	popd
 }
 
 glibc_do_src_install() {
@@ -1333,6 +1338,7 @@ glibc_do_src_install() {
 	# Generate all locales if this is a native build as locale generation
 	if use compile-locales && ! is_crosscompile ; then
 		run_locale_gen "${ED}"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
 	fi
 }
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 0b6964c6a3b..4d0a9edb57a 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1142,6 +1142,9 @@ run_locale_gen() {
 	# if the host locales.gen contains no entries, we'll install everything
 	local root="$1"
 	local locale_list="${root}/etc/locale.gen"
+
+	pushd "${ED}"/$(get_libdir)
+
 	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
 		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
 		locale_list="${root}/usr/share/i18n/SUPPORTED"
@@ -1149,6 +1152,8 @@ run_locale_gen() {
 
 	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
 		--destdir "${root}"
+
+	popd
 }
 
 glibc_do_src_install() {
@@ -1333,6 +1338,7 @@ glibc_do_src_install() {
 	# Generate all locales if this is a native build as locale generation
 	if use compile-locales && ! is_crosscompile ; then
 		run_locale_gen "${ED}"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
 	fi
 }
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-08-04  0:12 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-08-04  0:12 UTC (permalink / raw
  To: gentoo-commits

commit:     fb3ccd285e5a9580e778a1a60ead30221c407dbe
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Aug  4 00:12:16 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Aug  4 00:12:44 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fb3ccd28

sys-libs/glibc: Pass missing parameter to locale-gen

Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30.ebuild | 13 ++++++++++---
 sys-libs/glibc/glibc-9999.ebuild | 13 ++++++++++---
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30.ebuild b/sys-libs/glibc/glibc-2.30.ebuild
index 2d1e13c28ac..9bdb5a434c8 100644
--- a/sys-libs/glibc/glibc-2.30.ebuild
+++ b/sys-libs/glibc/glibc-2.30.ebuild
@@ -1141,16 +1141,23 @@ src_test() {
 run_locale_gen() {
 	# if the host locales.gen contains no entries, we'll install everything
 	local root="$1"
+	local inplace=""
+
+	if [[ ${root}=="--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
 	local locale_list="${root}/etc/locale.gen"
 
 	pushd "${ED}"/$(get_libdir)
 
 	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+		[[ -z ${inplace} ]] && ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
 		locale_list="${root}/usr/share/i18n/SUPPORTED"
 	fi
 
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
+	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
 		--destdir "${root}"
 
 	popd
@@ -1337,7 +1344,7 @@ glibc_do_src_install() {
 
 	# Generate all locales if this is a native build as locale generation
 	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
+		run_locale_gen --inplace-glibc "${ED}"
 		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
 	fi
 }

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 4d0a9edb57a..c9d06b20499 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1141,16 +1141,23 @@ src_test() {
 run_locale_gen() {
 	# if the host locales.gen contains no entries, we'll install everything
 	local root="$1"
+	local inplace=""
+
+	if [[ ${root}=="--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
 	local locale_list="${root}/etc/locale.gen"
 
 	pushd "${ED}"/$(get_libdir)
 
 	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+		[[ -z ${inplace} ]] && ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
 		locale_list="${root}/usr/share/i18n/SUPPORTED"
 	fi
 
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
+	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
 		--destdir "${root}"
 
 	popd
@@ -1337,7 +1344,7 @@ glibc_do_src_install() {
 
 	# Generate all locales if this is a native build as locale generation
 	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
+		run_locale_gen --inplace-glibc "${ED}"
 		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
 	fi
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-08-04 12:13 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-08-04 12:13 UTC (permalink / raw
  To: gentoo-commits

commit:     d81ba30c5565874289366899187f0a8ee255fa2a
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Aug  4 12:12:46 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Aug  4 12:13:31 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d81ba30c

sys-libs/glibc: Fix my broken bash code, bug 691378

This is the real fix for bug 691378.

Closes: https://bugs.gentoo.org/691378
Package-Manager: Portage-2.3.70, Repoman-2.3.16
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30.ebuild b/sys-libs/glibc/glibc-2.30.ebuild
index 9bdb5a434c8..3132a44fa53 100644
--- a/sys-libs/glibc/glibc-2.30.ebuild
+++ b/sys-libs/glibc/glibc-2.30.ebuild
@@ -1143,7 +1143,7 @@ run_locale_gen() {
 	local root="$1"
 	local inplace=""
 
-	if [[ ${root}=="--inplace-glibc" ]] ; then
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
 		inplace="--inplace-glibc"
 		root="$2"
 	fi

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index c9d06b20499..06154dba38f 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1143,7 +1143,7 @@ run_locale_gen() {
 	local root="$1"
 	local inplace=""
 
-	if [[ ${root}=="--inplace-glibc" ]] ; then
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
 		inplace="--inplace-glibc"
 		root="$2"
 	fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-08-05 12:30 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-08-05 12:30 UTC (permalink / raw
  To: gentoo-commits

commit:     ec6e4f507c0bedb3cbf2229ded7ab1a58a089868
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  5 12:30:07 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Aug  5 12:30:07 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec6e4f50

sys-libs/glibc: silence pushd and popd

Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30.ebuild | 4 ++--
 sys-libs/glibc/glibc-9999.ebuild | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30.ebuild b/sys-libs/glibc/glibc-2.30.ebuild
index 3132a44fa53..eafa9c84edb 100644
--- a/sys-libs/glibc/glibc-2.30.ebuild
+++ b/sys-libs/glibc/glibc-2.30.ebuild
@@ -1150,7 +1150,7 @@ run_locale_gen() {
 
 	local locale_list="${root}/etc/locale.gen"
 
-	pushd "${ED}"/$(get_libdir)
+	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"
@@ -1160,7 +1160,7 @@ run_locale_gen() {
 	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
 		--destdir "${root}"
 
-	popd
+	popd >/dev/null
 }
 
 glibc_do_src_install() {

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 06154dba38f..191295bf288 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1150,7 +1150,7 @@ run_locale_gen() {
 
 	local locale_list="${root}/etc/locale.gen"
 
-	pushd "${ED}"/$(get_libdir)
+	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"
@@ -1160,7 +1160,7 @@ run_locale_gen() {
 	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
 		--destdir "${root}"
 
-	popd
+	popd >/dev/null
 }
 
 glibc_do_src_install() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-08-06  0:59 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-08-06  0:59 UTC (permalink / raw
  To: gentoo-commits

commit:     fb2fe75af62ad29a44aeba1b8e9e41ce5acb3992
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  6 00:58:57 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Aug  6 00:59:28 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fb2fe75a

sys-libs/glibc: Add 2.29 revision with compile-locales support

Bug: https://bugs.gentoo.org/146882
Package-Manager: Portage-2.3.70, Repoman-2.3.16
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.29-r4.ebuild | 1473 +++++++++++++++++++++++++++++++++++
 2 files changed, 1474 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index fa4ab1108bb..c4b7296b07b 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,6 +16,7 @@ DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 4ab583be712994f949dee2512da6e12fd
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525eccfec462d638dbc25c581e5b7a2a72ffd5191842f5ac443a868cbc950838d7e5120e866d343a14b80c55dcbfa48f30 SHA512 4c9b78d9d1a8aa629418f2d758ef800857780b8a1fd8d3582b88348a513ca26ca7f6ac9110a8c6bae16949b360ba36840d184f42293cd4324760273592d1b438
 DIST glibc-2.29-patches-4.tar.xz 63576 BLAKE2B 4a9005326e16f8c6b9e1a38e596d66c9f8063572324bfde69c01d2eda3cb026425bcb8dc16ebfc75779e0a66d595f672501cfdafbac18a8a613b84b1d8e670ba SHA512 64b2756169444a865afb20c6fec2b4534f6ae36082cf517c882c8e5e6f7335636a8f0da1b8faf476558664da460db20f5d50f526044a4c203bd7874ecd62d945
+DIST glibc-2.29-patches-5.tar.xz 64032 BLAKE2B 6c3104bd80aaba617201812a631b734ded4b02f8d4dadb5e353af48692f2a1509ddae1d34098de913ae5b3ac1a29111a44dfae71c3024fab4a805a22e9d66e33 SHA512 39add1388268ecf2029cb90b8312fb610b203f459a092dc1da8b46ce91ccfbbdff235592aa6174edf9efe71039d984ee121dc9adf7e18490cf92fe24561b1267
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-1.tar.xz 19364 BLAKE2B 853ae651cf48a78796ac0a3c9c84098731d5a43b37644ee5029d2e2b06dab0d1d96b9dd7c3fd896c5513f5f712beca13845c1e24c698fe824ce0f529a2a827d4 SHA512 23065ec67b1a6302eece79da1ba731aa158a2abc0c65aed755cafea388c19aa1f545a6ea6d9db1fd128d06c6878b4c73aea07c6acc053b56bc416143e96e1c05
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b

diff --git a/sys-libs/glibc/glibc-2.29-r4.ebuild b/sys-libs/glibc/glibc-2.29-r4.ebuild
new file mode 100644
index 00000000000..c49d8263726
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.29-r4.ebuild
@@ -0,0 +1,1473 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python3_{5,6,7} )
+
+inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=5
+
+SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+	!sys-kernel/ps3-sources
+	!sys-libs/nss-db
+"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	DEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	DEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+		virtual/os-headers
+	"
+	RDEPEND+="
+		>=net-dns/libidn2-2.0.5
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake -s glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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' 2>/dev/null ; then
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		amd64)
+			# -march needed for #185404 #199334
+			# Note: This test only matters when the x86 ABI is enabled, so we could
+			# optimize a bit and elide it.
+			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparc64v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparcv9v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Over-zealous CFLAGS can often cause problems.  What may work for one
+	# person may not work for another.  To avoid a large influx of bugs
+	# relating to failed builds, we strip most CFLAGS out to ensure as few
+	# problems as possible.
+	strip-flags
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# Lock glibc at -O2; we want to be conservative here.
+	# -fno-strict-aliasing is to work around #155906.
+	filter-flags '-O?'
+	append-flags -O2 -fno-strict-aliasing
+
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ ${ROOT} != "/" ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ ${ROOT} == "/" ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=$(usex ssp all no) )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	local locale_list="${root}/etc/locale.gen"
+
+	pushd "${ED}"/$(get_libdir)
+
+	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"
+	fi
+
+	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+
+	popd
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install || die
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_strip() {
+	# gdb is lame and requires some debugging information to remain in
+	# libpthread, so we need to strip it by hand.  libthread_db makes no
+	# sense stripped as it is only used when debugging.
+	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
+	env \
+		-uRESTRICT \
+		CHOST=${CTARGET} \
+		STRIP_MASK="/*/{,tls/}${pthread}*" \
+		prepallstrip
+	# if user has stripping enabled and does not have split debug turned on,
+	# then leave the debugging sections in libpthread.
+	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
+		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
+	fi
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+	src_strip
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ ${ROOT} != "/" ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+	fi
+
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		use compile-locales || run_locale_gen "${EROOT}"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-08-09 20:07 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-08-09 20:07 UTC (permalink / raw
  To: gentoo-commits

commit:     4408b27b27184a23905d344f07550b7a1e3fb2ef
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  9 20:06:43 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Aug  9 20:06:43 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4408b27b

sys-libs/glibc: remove old

Package-Manager: Portage-2.3.70, Repoman-2.3.16
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    3 -
 sys-libs/glibc/glibc-2.23-r4.ebuild |  154 ----
 sys-libs/glibc/glibc-2.29-r3.ebuild | 1460 -----------------------------------
 3 files changed, 1617 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index c4b7296b07b..b75203288d8 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -2,8 +2,6 @@ DIST gcc-4.7.3-r1-multilib-bootstrap.tar.bz2 8064097 BLAKE2B 3cc5c82cd57d0fbd26d
 DIST gcc-multilib-bootstrap-20180511.tar.xz 2392908 BLAKE2B f3cf614399368acd8908f60d894c6344a2fa09383b30c1633a0682bc668367c8a2f8c6fec2d41b6e2178d709a2bd8db57e8b2ab56ba263c7d56f819c15acd061 SHA512 98c766e913693ab42ff790557acde2a36a8001e2648046a685b21964200df8d4d52d8452d499c0068c6648284d086ce062c2d36e2c6c2fd8aacd232d193f2853
 DIST glibc-2.19-patches-9.tar.bz2 24584 BLAKE2B a96e930a5bd20fa75d9f259cc2117fa5ce98072274a24a5823bf877e3739fa4c001a94d7865e065ee0527f3974430d27da8038e042340a451ad2052c62724f26 SHA512 a95b3063ade974a3556480b798b317d33c7423a8cb9e69f67249ffb8b3d3c671d70d2d5f782c1efadc0bec4cc49a96d4fe89911f3dfcd85b459f69f3b4f38f0e
 DIST glibc-2.19.tar.xz 12083312 BLAKE2B 9dc03346e0f0df4bf009a92d894b0a9f964ff92b7f4c9663cedf1cb6cf90435f28a15539d33791ecf43ee578fa4e26f916af0367651312ef8f9c1c38ce0dafa2 SHA512 9e021fcb3afbb9ace2a0e37fded231a62de861bd766e29d47163a03182e37add718b7acc3963d1c525f9556773e842297725715acde48dcfbaab6e756af1a23d
-DIST glibc-2.23-patches-8.tar.bz2 304199 BLAKE2B 693e40090dbe43f0e9c1faa0bce75e43d5d3924b40c141f9d00ef147fd285b03e2c3bab6a32d1bf6978ca139c3f071f685d5caf1bffb1cce7e1d1f3c346e5c50 SHA512 470814bbbd9d4ee5fa2dd7570a2e14b0229723e373e801472856fd6c2f089499eddc300f69b49af8ba0edbdca583ee3ca521fdb5c642509717cafea0ad925fd2
-DIST glibc-2.23.tar.xz 13455260 BLAKE2B 6658e9d2d07c5cd71be94ef399bfe4d18ef462e4154e2e02aa69c34198e881cc65ac8f89abcb37b3d01c56b10e2f47c036492c20e4991a54bd03e56db703fbd2 SHA512 b82953388cd028e174cb08f082557bbce0dad8b67b17d31b29f90102fd52a51e03d591448ecb64882a1c1d5303afffc7f6ede85cee4c784a9284fbc9b4ad26cf
 DIST glibc-2.24-patches-10.tar.bz2 73586 BLAKE2B f42cc78b907e7cb5c8ba1672c845cdc0959f4d29f89ff642bd2efa795d7ac69409b514338ac1f4235ce2fbc0c9c9bb2d152f55fd14c02997517dc048a306e1c1 SHA512 fc9191a85da53a2515bbaab228648936682e04267284049468e0c82284f618ab2907b9247baca701e16edc50640199ff6d8e2a6a93ccbd5a9d3b0eb73cc484ca
 DIST glibc-2.24.tar.xz 13554048 BLAKE2B 9f93ac00f68eb88e3a2272752624163fac25dd064170e336143aa697908fba2b27ed926582f978da99c6c2489c0ce34d3eb266b5d00be69d27b36126bc2c8efb SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb
 DIST glibc-2.25-patches-15.tar.bz2 78320 BLAKE2B 70c62cc10db13e2844de4d8a18972e0f4d01ba52fbd40db57c11d7b1c2c0d571b894f01e762bb26632fd696a77c299ef0766e2f129d2eda896f58325a754a13c SHA512 7204218ea82b677e0f278c4752ddb90aa0c08ac2349d061de81ec91dac204b0f10fe223d7b1055b9e0c21dac97c835f913a90c0168a5000d3be00dd20027c185
@@ -15,7 +13,6 @@ DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea
 DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 4ab583be712994f949dee2512da6e12fd7f7ad73e96393f21678552b43da98f49321b53b5b009551300cdb09ca135e7f6adc636ff750c251a1d6d7f262dbc410 SHA512 e3f40ae6e9d06471c1a11bd2bce7b5161d07c3d0a81791505a72aec4817e7faf9ef09841e98c6dcf62a0a00754dff87dd194d97ac6b6354aeb2497cf60900b96
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525eccfec462d638dbc25c581e5b7a2a72ffd5191842f5ac443a868cbc950838d7e5120e866d343a14b80c55dcbfa48f30 SHA512 4c9b78d9d1a8aa629418f2d758ef800857780b8a1fd8d3582b88348a513ca26ca7f6ac9110a8c6bae16949b360ba36840d184f42293cd4324760273592d1b438
-DIST glibc-2.29-patches-4.tar.xz 63576 BLAKE2B 4a9005326e16f8c6b9e1a38e596d66c9f8063572324bfde69c01d2eda3cb026425bcb8dc16ebfc75779e0a66d595f672501cfdafbac18a8a613b84b1d8e670ba SHA512 64b2756169444a865afb20c6fec2b4534f6ae36082cf517c882c8e5e6f7335636a8f0da1b8faf476558664da460db20f5d50f526044a4c203bd7874ecd62d945
 DIST glibc-2.29-patches-5.tar.xz 64032 BLAKE2B 6c3104bd80aaba617201812a631b734ded4b02f8d4dadb5e353af48692f2a1509ddae1d34098de913ae5b3ac1a29111a44dfae71c3024fab4a805a22e9d66e33 SHA512 39add1388268ecf2029cb90b8312fb610b203f459a092dc1da8b46ce91ccfbbdff235592aa6174edf9efe71039d984ee121dc9adf7e18490cf92fe24561b1267
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-1.tar.xz 19364 BLAKE2B 853ae651cf48a78796ac0a3c9c84098731d5a43b37644ee5029d2e2b06dab0d1d96b9dd7c3fd896c5513f5f712beca13845c1e24c698fe824ce0f529a2a827d4 SHA512 23065ec67b1a6302eece79da1ba731aa158a2abc0c65aed755cafea388c19aa1f545a6ea6d9db1fd128d06c6878b4c73aea07c6acc053b56bc416143e96e1c05

diff --git a/sys-libs/glibc/glibc-2.23-r4.ebuild b/sys-libs/glibc/glibc-2.23-r4.ebuild
deleted file mode 100644
index 19d2ee3adaf..00000000000
--- a/sys-libs/glibc/glibc-2.23-r4.ebuild
+++ /dev/null
@@ -1,154 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit toolchain-glibc
-
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
-RESTRICT="strip" # strip ourself #46186
-EMULTILIB_PKG="true"
-
-# Configuration variables
-RELEASE_VER=""
-case ${PV} in
-9999*)
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
-	inherit git-r3
-	;;
-*)
-	RELEASE_VER=${PV}
-	;;
-esac
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="8"                                  # Gentoo patchset
-: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
-
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla headers-only"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2"
-RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	!sys-libs/nss-db"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.7
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.7
-		virtual/os-headers"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI HTTP~tamiko/distfiles/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
-}
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
-
-src_unpack() {
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	toolchain-glibc_src_unpack
-}
-
-src_prepare() {
-	toolchain-glibc_src_prepare
-
-	cd "${S}"
-
-	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-
-		# Build various bits with ssp-all
-		sed -i \
-			-e 's:-fstack-protector$:-fstack-protector-all:' \
-			*/Makefile || die
-	fi
-
-	case $(gcc-fullversion) in
-	4.8.[0-3]|4.9.0)
-		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
-		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
-		die "need to switch compilers #547420"
-		;;
-	esac
-}

diff --git a/sys-libs/glibc/glibc-2.29-r3.ebuild b/sys-libs/glibc/glibc-2.29-r3.ebuild
deleted file mode 100644
index f94b65fed35..00000000000
--- a/sys-libs/glibc/glibc-2.29-r3.ebuild
+++ /dev/null
@@ -1,1460 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-PYTHON_COMPAT=( python3_{5,6,7} )
-
-inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=4
-
-SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-		virtual/os-headers
-	"
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all no) )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-		locale_list="${root}/usr/share/i18n/SUPPORTED"
-	fi
-
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-	src_strip
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-08-12 21:35 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-08-12 21:35 UTC (permalink / raw
  To: gentoo-commits

commit:     2594fae266f33b20fe11d36c4ce7e1f3573589f6
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 12 21:27:58 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Aug 12 21:27:58 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2594fae2

sys-libs/glibc: port to EAPI=7

Package-Manager: Portage-2.3.70, Repoman-2.3.16
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 47 ++++++++++++++--------------------------
 1 file changed, 16 insertions(+), 31 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 191295bf288..6e19a44aaa1 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1,17 +1,16 @@
 # Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI=7
 
 PYTHON_COMPAT=( python3_{5,6,7} )
 
-inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
 	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
 SLOT="2.2"
 
 EMULTILIB_PKG="true"
@@ -1167,7 +1166,7 @@ glibc_do_src_install() {
 	local builddir=$(builddir nptl)
 	cd "${builddir}"
 
-	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install || die
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install || die
 
 	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
 	# which come without headers etc. Only needed for binary packages since the
@@ -1180,13 +1179,18 @@ glibc_do_src_install() {
 	# '#define VERSION "2.26.90"' -> '2.26.90'
 	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
 
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+	# gdb is lame and requires some debugging information to remain in
+	# libpthread.  libthread_db makes no sense stripped as it is only used when debugging.
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	dostrip -x $(alt_libdir)/libthread_db-1.0.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
 		# Move versioned .a file out of libdir to evade portage QA checks
 		# instead of using gen_usr_ldscript(). We fix ldscript as:
 		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
 		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
 	fi
 
 	# We'll take care of the cache ourselves
@@ -1344,7 +1348,7 @@ glibc_do_src_install() {
 
 	# Generate all locales if this is a native build as locale generation
 	if use compile-locales && ! is_crosscompile ; then
-		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
 	fi
 }
@@ -1352,7 +1356,7 @@ glibc_do_src_install() {
 glibc_headers_install() {
 	local builddir=$(builddir "headers")
 	cd "${builddir}"
-	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
 
 	insinto $(alt_headers)/gnu
 	doins "${S}"/include/gnu/stubs.h
@@ -1363,23 +1367,6 @@ glibc_headers_install() {
 	dosym usr/include $(alt_prefix)/sys-include
 }
 
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
 src_install() {
 	if just_headers ; then
 		export ABI=default
@@ -1393,8 +1380,6 @@ src_install() {
 		elog "Not installing static glibc libraries"
 		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
 	fi
-
-	src_strip
 }
 
 # Simple test to make sure our new glibc isn't completely broken.
@@ -1447,7 +1432,7 @@ pkg_preinst() {
 		einfo "Defaulting /etc/host.conf:multi to on"
 	fi
 
-	[[ ${ROOT} != "/" ]] && return 0
+	[[ -n ${ROOT} ]] && return 0
 	[[ -d ${ED}/$(get_libdir) ]] || return 0
 	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
 }
@@ -1458,10 +1443,10 @@ pkg_postinst() {
 
 	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
 		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT%/}/"
 	fi
 
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
 		# Reload init ... if in a chroot or a diff init package, ignore
 		# errors from this step #253697
 		/sbin/telinit U 2>/dev/null


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-08-13 20:10 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-08-13 20:10 UTC (permalink / raw
  To: gentoo-commits

commit:     47097344d65802b639cd858f580a25687a438116
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 13 20:10:32 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Aug 13 20:10:32 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=47097344

sys-libs/glibc: Additional EAPI=7 fixes found by Arfrever

Package-Manager: Portage-2.3.70, Repoman-2.3.16
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 6e19a44aaa1..09bf788700f 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -521,7 +521,7 @@ check_devpts() {
 	[[ ${MERGE_TYPE} == "buildonly" ]] && return
 
 	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
+	[[ -n ${ROOT} ]] && return
 
 	# If they're opting in to the old suid code, then no need to check.
 	use suid && return
@@ -609,7 +609,7 @@ sanity_prechecks() {
 
 	# Prevent native builds from downgrading
 	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
+	   [[ -z ${ROOT} ]] && \
 	   [[ ${CBUILD} == ${CHOST} ]] && \
 	   [[ ${CHOST} == ${CTARGET} ]] ; then
 
@@ -1101,7 +1101,7 @@ src_configure() {
 }
 
 do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
+	emake -C "$(builddir nptl)"
 }
 
 src_compile() {
@@ -1166,7 +1166,7 @@ glibc_do_src_install() {
 	local builddir=$(builddir nptl)
 	cd "${builddir}"
 
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install || die
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
 
 	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
 	# which come without headers etc. Only needed for binary packages since the
@@ -1348,7 +1348,7 @@ glibc_do_src_install() {
 
 	# Generate all locales if this is a native build as locale generation
 	if use compile-locales && ! is_crosscompile ; then
-		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
 	fi
 }
@@ -1443,7 +1443,7 @@ pkg_postinst() {
 
 	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
 		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT%/}/"
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
 	fi
 
 	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
@@ -1451,7 +1451,7 @@ pkg_postinst() {
 		# errors from this step #253697
 		/sbin/telinit U 2>/dev/null
 
-		use compile-locales || run_locale_gen "${EROOT}"
+		use compile-locales || run_locale_gen "${EROOT}/"
 	fi
 
 	# Check for sanity of /etc/nsswitch.conf, take 2


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-08-13 21:36 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-08-13 21:36 UTC (permalink / raw
  To: gentoo-commits

commit:     8ea89b86b63b91759bd5ee476bc8ee9008f7398b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 13 21:35:54 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Aug 13 21:36:17 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8ea89b86

sys-libs/glibc: BDEPEND implementation

Package-Manager: Portage-2.3.70, Repoman-2.3.16
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 09bf788700f..ea591126e85 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -64,6 +64,16 @@ fi
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,
 # and that gcc already contains the hardened patches.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
+"
 COMMON_DEPEND="
 	nscd? ( selinux? (
 		audit? ( sys-process/audit )
@@ -74,14 +84,6 @@ COMMON_DEPEND="
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
 	test? ( >=net-dns/libidn2-2.0.5 )
 "
 RDEPEND="${COMMON_DEPEND}
@@ -91,17 +93,17 @@ RDEPEND="${COMMON_DEPEND}
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
+	BDEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24
 		>=${CATEGORY}/gcc-6
 	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+	[[ ${CATEGORY} == *-linux* ]] && BDEPEND+=" ${CATEGORY}/linux-headers"
 else
-	DEPEND+="
+	BDEPEND+="
 		>=sys-devel/binutils-2.24
 		>=sys-devel/gcc-6
-		virtual/os-headers
 	"
+	DEPEND+=" virtual/os-headers "
 	RDEPEND+="
 		>=net-dns/libidn2-2.0.5
 		vanilla? ( !sys-libs/timezone-data )


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-08-14 21:27 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-08-14 21:27 UTC (permalink / raw
  To: gentoo-commits

commit:     e36d331977084e21f8539859cf52d1f2ce8ef28c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 14 21:27:39 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Aug 14 21:27:54 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e36d3319

sys-libs/glibc: Put linux-headers in DEPEND instead of BDEPEND

Package-Manager: Portage-2.3.70, Repoman-2.3.16
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ea591126e85..e1955052ee3 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -97,7 +97,7 @@ if [[ ${CATEGORY} == cross-* ]] ; then
 		>=${CATEGORY}/binutils-2.24
 		>=${CATEGORY}/gcc-6
 	)"
-	[[ ${CATEGORY} == *-linux* ]] && BDEPEND+=" ${CATEGORY}/linux-headers"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
 else
 	BDEPEND+="
 		>=sys-devel/binutils-2.24


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-08-21 22:35 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-08-21 22:35 UTC (permalink / raw
  To: gentoo-commits

commit:     00b7def5a8a7581858059ef4710d26542f3eee47
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 21 22:34:28 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Aug 21 22:35:21 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=00b7def5

sys-libs/glibc: drop telinit call from pkg_*(), bug #642784

Rely on sysvinit re-execution on shutdown (bug #642858)
instead of relying on glibc's pkg_*() phases.

Reported-by: Mike Gilbert
Bug: https://bugs.gentoo.org/642784
Package-Manager: Portage-2.3.72, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30.ebuild | 4 ----
 sys-libs/glibc/glibc-9999.ebuild | 4 ----
 2 files changed, 8 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30.ebuild b/sys-libs/glibc/glibc-2.30.ebuild
index eafa9c84edb..743f14c253d 100644
--- a/sys-libs/glibc/glibc-2.30.ebuild
+++ b/sys-libs/glibc/glibc-2.30.ebuild
@@ -1462,10 +1462,6 @@ pkg_postinst() {
 	fi
 
 	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
 		use compile-locales || run_locale_gen "${EROOT}"
 	fi
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index e1955052ee3..1075f02be79 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1449,10 +1449,6 @@ pkg_postinst() {
 	fi
 
 	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
 		use compile-locales || run_locale_gen "${EROOT}/"
 	fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-08-27  1:14 Benda XU
  0 siblings, 0 replies; 1076+ messages in thread
From: Benda XU @ 2019-08-27  1:14 UTC (permalink / raw
  To: gentoo-commits

commit:     41c407c3f6a0b41fbfc745227caccd6480eff20d
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 27 01:13:29 2019 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Tue Aug 27 01:13:49 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=41c407c3

sys-libs/glibc: remove version_is_at_least.

  As of 2019 Prefix, the conditions are always true.

Package-Manager: Portage-2.3.73, Repoman-2.3.17
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild | 52 +++----------------------------------
 1 file changed, 4 insertions(+), 48 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index a0b75a595e9..42ed9d4e04d 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -255,20 +255,10 @@ setup_target_flags() {
 			sparc64-*)
 				case $(get-flag mcpu) in
 				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparc64v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
+					cpu="sparc64v2"
 					;;
 				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
+					cpu="sparc64v"
 					;;
 				ultrasparc3)
 					cpu="sparc64b"
@@ -284,24 +274,10 @@ setup_target_flags() {
 			sparc-*)
 				case $(get-flag mcpu) in
 				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparcv9v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
+					cpu="sparcv9v2"
 					;;
 				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
+					cpu="sparcv9v"
 					;;
 				ultrasparc3)
 					cpu="sparcv9b"
@@ -397,25 +373,6 @@ want__thread() {
 	return ${WANT__THREAD}
 }
 
-use_multiarch() {
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	version_is_at_least ${nver} ${bver}
-}
-
 # Setup toolchain variables that had historically been defined in the
 # profiles for these archs.
 setup_env() {
@@ -860,7 +817,6 @@ glibc_do_configure() {
 		--libexecdir='$(libdir)'/misc/glibc
 		--with-bugurl=https://bugs.gentoo.org/
 		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
 		$(use_enable systemtap)
 		$(use_enable nscd)
 		${EXTRA_ECONF}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-08-28 18:28 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-08-28 18:28 UTC (permalink / raw
  To: gentoo-commits

commit:     b61ab167e82261ed2078c068ba0c2fc3a7b58aa3
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 28 18:28:23 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Aug 28 18:28:23 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b61ab167

sys-libs/glibc: stable 2.29-r2 for hppa, bug #685818

Package-Manager: Portage-2.3.73, Repoman-2.3.17
RepoMan-Options: --include-arches="hppa"
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index a9ed33739e8..8165b300294 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -20,7 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 m68k ~mips ppc ppc64 ~riscv s390 sh ~sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 ~riscv s390 sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-09-01 16:50 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-09-01 16:50 UTC (permalink / raw
  To: gentoo-commits

commit:     8893df0d11de029e26b31bc3310e43ccb6b35dc3
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  1 16:47:47 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Sep  1 16:50:41 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8893df0d

sys-libs/glibc: revert CPPFLAGS fix for cross-compilers

In https://sourceware.org/PR24577 we discovered that riscv
can't really install libc headers as it needs a cross-compiler.

This revert reintroduces riscv bootstrap on crossdev.
To workaround it use the -without-headers option until
it's a crossdev's default.

Bug: https://sourceware.org/PR24577
Bug: https://bugs.gentoo.org/692052
Bug: https://bugs.gentoo.org/686248
Package-Manager: Portage-2.3.74, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest                            |   4 +-
 .../{glibc-9999.ebuild => glibc-2.29-r5.ebuild}    | 122 +++++++++++----------
 .../{glibc-9999.ebuild => glibc-2.30-r1.ebuild}    |  81 ++++++++------
 sys-libs/glibc/glibc-9999.ebuild                   |   2 +-
 4 files changed, 114 insertions(+), 95 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index b75203288d8..e8f7dda1268 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,7 +14,9 @@ DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 4ab583be712994f949dee2512da6e12fd
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525eccfec462d638dbc25c581e5b7a2a72ffd5191842f5ac443a868cbc950838d7e5120e866d343a14b80c55dcbfa48f30 SHA512 4c9b78d9d1a8aa629418f2d758ef800857780b8a1fd8d3582b88348a513ca26ca7f6ac9110a8c6bae16949b360ba36840d184f42293cd4324760273592d1b438
 DIST glibc-2.29-patches-5.tar.xz 64032 BLAKE2B 6c3104bd80aaba617201812a631b734ded4b02f8d4dadb5e353af48692f2a1509ddae1d34098de913ae5b3ac1a29111a44dfae71c3024fab4a805a22e9d66e33 SHA512 39add1388268ecf2029cb90b8312fb610b203f459a092dc1da8b46ce91ccfbbdff235592aa6174edf9efe71039d984ee121dc9adf7e18490cf92fe24561b1267
+DIST glibc-2.29-patches-6.tar.xz 64076 BLAKE2B 04c1baf838eff9275e79145d4a5a642dcd6572aadcdfc6782769f2de107dcd1648b81d0690068db8c0d53229efe2130e279f4aafe8a91238e5dd6a8a7120a433 SHA512 6494dcd23441fe308de97706f7abbea1571e0015d1456e719268b8026e1fb23733c2efd5256840f4b9f0df4f02ac7827b1fad56905cbd8919bca9c25b0afe822
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-1.tar.xz 19364 BLAKE2B 853ae651cf48a78796ac0a3c9c84098731d5a43b37644ee5029d2e2b06dab0d1d96b9dd7c3fd896c5513f5f712beca13845c1e24c698fe824ce0f529a2a827d4 SHA512 23065ec67b1a6302eece79da1ba731aa158a2abc0c65aed755cafea388c19aa1f545a6ea6d9db1fd128d06c6878b4c73aea07c6acc053b56bc416143e96e1c05
+DIST glibc-2.30-patches-2.tar.xz 19588 BLAKE2B 672343ef8a44486304f03091844635febef9d1bc8000ab3382d702dcc1111a107b5e758355beaef8db5012f7e324e4c2365e10fc642b01c9f9a3a315de2dc7f6 SHA512 494155147b56e094a4427aed79e278b4a350928ddaff84330d6a40fad079131a4574f20c591dc95e572391b68ef72c49790571ee5323a2a541ec0757bcaeb161
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
-DIST glibc-9999-patches-13.tar.xz 18316 BLAKE2B c55359dda094dabfec85f53e48fcd43985d41211f29c0c3ba0d07c4ce28994f96c334c9fcc2a6b78e64123363253c701ed6e9335f4e74274c984734ac8881731 SHA512 627799f65f79e60ed3a9ba1a499d21e771f1b109934967c9fbdf3300b0c1509ef5382834e63c8ead23ffbaee80becf541da5b25e4e2cfa8f6baa801c3838c69d
+DIST glibc-9999-patches-14.tar.xz 17908 BLAKE2B a6e1f22a4358111ff757431c5d42fd020f6095584c3517aa854ea266129d1a177a7c09b310643f1cea32ffaf253806ac08f3aed864fb477097aaa2c4010450f4 SHA512 ef28b409b26472ec1d868167345aecfee70b1edf1863374dc2f25892f40c10f0826620a8b22fbbc9f737c8f611569b3412e8e2ea041da1ad1ef7f6398b82cddc

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.29-r5.ebuild
similarity index 94%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.29-r5.ebuild
index 1075f02be79..d02d0fcb97d 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r5.ebuild
@@ -1,16 +1,17 @@
 # Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=6
 
 PYTHON_COMPAT=( python3_{5,6,7} )
 
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
+inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
 	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
 SLOT="2.2"
 
 EMULTILIB_PKG="true"
@@ -19,8 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 
@@ -29,12 +29,12 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=13
+PATCH_VER=6
 
 SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps cet compile-locales custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -64,16 +64,6 @@ fi
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,
 # and that gcc already contains the hardened patches.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-"
 COMMON_DEPEND="
 	nscd? ( selinux? (
 		audit? ( sys-process/audit )
@@ -84,6 +74,14 @@ COMMON_DEPEND="
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
 	test? ( >=net-dns/libidn2-2.0.5 )
 "
 RDEPEND="${COMMON_DEPEND}
@@ -93,17 +91,17 @@ RDEPEND="${COMMON_DEPEND}
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
+	DEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24
 		>=${CATEGORY}/gcc-6
 	)"
 	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
 else
-	BDEPEND+="
+	DEPEND+="
 		>=sys-devel/binutils-2.24
 		>=sys-devel/gcc-6
+		virtual/os-headers
 	"
-	DEPEND+=" virtual/os-headers "
 	RDEPEND+="
 		>=net-dns/libidn2-2.0.5
 		vanilla? ( !sys-libs/timezone-data )
@@ -358,18 +356,11 @@ setup_flags() {
 	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
 	ASFLAGS=${ASFLAGS_BASE}
 
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
+	# Over-zealous CFLAGS can often cause problems.  What may work for one
+	# person may not work for another.  To avoid a large influx of bugs
+	# relating to failed builds, we strip most CFLAGS out to ensure as few
+	# problems as possible.
+	strip-flags
 	strip-unsupported-flags
 	filter-flags -m32 -m64 '-mabi=*'
 
@@ -391,9 +382,10 @@ setup_flags() {
 		CBUILD_OPT=${CTARGET_OPT}
 	fi
 
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
+	# Lock glibc at -O2; we want to be conservative here.
+	# -fno-strict-aliasing is to work around #155906.
+	filter-flags '-O?'
+	append-flags -O2 -fno-strict-aliasing
 
 	filter-flags '-fstack-protector*'
 }
@@ -523,7 +515,7 @@ check_devpts() {
 	[[ ${MERGE_TYPE} == "buildonly" ]] && return
 
 	# Only sanity check when installing the native glibc.
-	[[ -n ${ROOT} ]] && return
+	[[ ${ROOT} != "/" ]] && return
 
 	# If they're opting in to the old suid code, then no need to check.
 	use suid && return
@@ -611,7 +603,7 @@ sanity_prechecks() {
 
 	# Prevent native builds from downgrading
 	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
+	   [[ ${ROOT} == "/" ]] && \
 	   [[ ${CBUILD} == ${CHOST} ]] && \
 	   [[ ${CHOST} == ${CTARGET} ]] ; then
 
@@ -1103,7 +1095,7 @@ src_configure() {
 }
 
 do_src_compile() {
-	emake -C "$(builddir nptl)"
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
 }
 
 src_compile() {
@@ -1151,7 +1143,7 @@ run_locale_gen() {
 
 	local locale_list="${root}/etc/locale.gen"
 
-	pushd "${ED}"/$(get_libdir) >/dev/null
+	pushd "${ED}"/$(get_libdir)
 
 	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
 		[[ -z ${inplace} ]] && ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
@@ -1161,14 +1153,14 @@ run_locale_gen() {
 	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
 		--destdir "${root}"
 
-	popd >/dev/null
+	popd
 }
 
 glibc_do_src_install() {
 	local builddir=$(builddir nptl)
 	cd "${builddir}"
 
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install || die
 
 	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
 	# which come without headers etc. Only needed for binary packages since the
@@ -1181,18 +1173,13 @@ glibc_do_src_install() {
 	# '#define VERSION "2.26.90"' -> '2.26.90'
 	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
 
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread.  libthread_db makes no sense stripped as it is only used when debugging.
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	dostrip -x $(alt_libdir)/libthread_db-1.0.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
 		# instead of using gen_usr_ldscript(). We fix ldscript as:
 		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
 		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
 	fi
 
 	# We'll take care of the cache ourselves
@@ -1350,7 +1337,7 @@ glibc_do_src_install() {
 
 	# Generate all locales if this is a native build as locale generation
 	if use compile-locales && ! is_crosscompile ; then
-		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
 	fi
 }
@@ -1358,7 +1345,7 @@ glibc_do_src_install() {
 glibc_headers_install() {
 	local builddir=$(builddir "headers")
 	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
 
 	insinto $(alt_headers)/gnu
 	doins "${S}"/include/gnu/stubs.h
@@ -1369,6 +1356,23 @@ glibc_headers_install() {
 	dosym usr/include $(alt_prefix)/sys-include
 }
 
+src_strip() {
+	# gdb is lame and requires some debugging information to remain in
+	# libpthread, so we need to strip it by hand.  libthread_db makes no
+	# sense stripped as it is only used when debugging.
+	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
+	env \
+		-uRESTRICT \
+		CHOST=${CTARGET} \
+		STRIP_MASK="/*/{,tls/}${pthread}*" \
+		prepallstrip
+	# if user has stripping enabled and does not have split debug turned on,
+	# then leave the debugging sections in libpthread.
+	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
+		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
+	fi
+}
+
 src_install() {
 	if just_headers ; then
 		export ABI=default
@@ -1377,11 +1381,7 @@ src_install() {
 	fi
 
 	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
+	src_strip
 }
 
 # Simple test to make sure our new glibc isn't completely broken.
@@ -1434,7 +1434,7 @@ pkg_preinst() {
 		einfo "Defaulting /etc/host.conf:multi to on"
 	fi
 
-	[[ -n ${ROOT} ]] && return 0
+	[[ ${ROOT} != "/" ]] && return 0
 	[[ -d ${ED}/$(get_libdir) ]] || return 0
 	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
 }
@@ -1445,11 +1445,15 @@ pkg_postinst() {
 
 	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
 		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
 	fi
 
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		# Reload init ... if in a chroot or a diff init package, ignore
+		# errors from this step #253697
+		/sbin/telinit U 2>/dev/null
+
+		use compile-locales || run_locale_gen "${EROOT}"
 	fi
 
 	# Check for sanity of /etc/nsswitch.conf, take 2

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.30-r1.ebuild
similarity index 96%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.30-r1.ebuild
index 1075f02be79..2846ee6a61c 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r1.ebuild
@@ -1,16 +1,17 @@
 # Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=6
 
 PYTHON_COMPAT=( python3_{5,6,7} )
 
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
+inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
 	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
 SLOT="2.2"
 
 EMULTILIB_PKG="true"
@@ -29,7 +30,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=13
+PATCH_VER=2
 
 SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
@@ -64,16 +65,6 @@ fi
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,
 # and that gcc already contains the hardened patches.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-"
 COMMON_DEPEND="
 	nscd? ( selinux? (
 		audit? ( sys-process/audit )
@@ -84,6 +75,14 @@ COMMON_DEPEND="
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
 	test? ( >=net-dns/libidn2-2.0.5 )
 "
 RDEPEND="${COMMON_DEPEND}
@@ -93,17 +92,17 @@ RDEPEND="${COMMON_DEPEND}
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
+	DEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24
 		>=${CATEGORY}/gcc-6
 	)"
 	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
 else
-	BDEPEND+="
+	DEPEND+="
 		>=sys-devel/binutils-2.24
 		>=sys-devel/gcc-6
+		virtual/os-headers
 	"
-	DEPEND+=" virtual/os-headers "
 	RDEPEND+="
 		>=net-dns/libidn2-2.0.5
 		vanilla? ( !sys-libs/timezone-data )
@@ -523,7 +522,7 @@ check_devpts() {
 	[[ ${MERGE_TYPE} == "buildonly" ]] && return
 
 	# Only sanity check when installing the native glibc.
-	[[ -n ${ROOT} ]] && return
+	[[ ${ROOT} != "/" ]] && return
 
 	# If they're opting in to the old suid code, then no need to check.
 	use suid && return
@@ -611,7 +610,7 @@ sanity_prechecks() {
 
 	# Prevent native builds from downgrading
 	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
+	   [[ ${ROOT} == "/" ]] && \
 	   [[ ${CBUILD} == ${CHOST} ]] && \
 	   [[ ${CHOST} == ${CTARGET} ]] ; then
 
@@ -1103,7 +1102,7 @@ src_configure() {
 }
 
 do_src_compile() {
-	emake -C "$(builddir nptl)"
+	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
 }
 
 src_compile() {
@@ -1168,7 +1167,7 @@ glibc_do_src_install() {
 	local builddir=$(builddir nptl)
 	cd "${builddir}"
 
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install || die
 
 	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
 	# which come without headers etc. Only needed for binary packages since the
@@ -1181,18 +1180,13 @@ glibc_do_src_install() {
 	# '#define VERSION "2.26.90"' -> '2.26.90'
 	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
 
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread.  libthread_db makes no sense stripped as it is only used when debugging.
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	dostrip -x $(alt_libdir)/libthread_db-1.0.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
 		# instead of using gen_usr_ldscript(). We fix ldscript as:
 		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
 		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
 	fi
 
 	# We'll take care of the cache ourselves
@@ -1350,7 +1344,7 @@ glibc_do_src_install() {
 
 	# Generate all locales if this is a native build as locale generation
 	if use compile-locales && ! is_crosscompile ; then
-		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
 	fi
 }
@@ -1358,7 +1352,7 @@ glibc_do_src_install() {
 glibc_headers_install() {
 	local builddir=$(builddir "headers")
 	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
 
 	insinto $(alt_headers)/gnu
 	doins "${S}"/include/gnu/stubs.h
@@ -1369,6 +1363,23 @@ glibc_headers_install() {
 	dosym usr/include $(alt_prefix)/sys-include
 }
 
+src_strip() {
+	# gdb is lame and requires some debugging information to remain in
+	# libpthread, so we need to strip it by hand.  libthread_db makes no
+	# sense stripped as it is only used when debugging.
+	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
+	env \
+		-uRESTRICT \
+		CHOST=${CTARGET} \
+		STRIP_MASK="/*/{,tls/}${pthread}*" \
+		prepallstrip
+	# if user has stripping enabled and does not have split debug turned on,
+	# then leave the debugging sections in libpthread.
+	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
+		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
+	fi
+}
+
 src_install() {
 	if just_headers ; then
 		export ABI=default
@@ -1382,6 +1393,8 @@ src_install() {
 		elog "Not installing static glibc libraries"
 		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
 	fi
+
+	src_strip
 }
 
 # Simple test to make sure our new glibc isn't completely broken.
@@ -1434,7 +1447,7 @@ pkg_preinst() {
 		einfo "Defaulting /etc/host.conf:multi to on"
 	fi
 
-	[[ -n ${ROOT} ]] && return 0
+	[[ ${ROOT} != "/" ]] && return 0
 	[[ -d ${ED}/$(get_libdir) ]] || return 0
 	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
 }
@@ -1445,11 +1458,11 @@ pkg_postinst() {
 
 	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
 		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
 	fi
 
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
+	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}"
 	fi
 
 	# Check for sanity of /etc/nsswitch.conf, take 2

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 1075f02be79..cd66539a922 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -29,7 +29,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=13
+PATCH_VER=14
 
 SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-09-01 21:59 Matt Turner
  0 siblings, 0 replies; 1076+ messages in thread
From: Matt Turner @ 2019-09-01 21:59 UTC (permalink / raw
  To: gentoo-commits

commit:     9c04d06d06d51d9c76b3fe5ceb573213769f45ae
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  1 21:59:24 2019 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Sun Sep  1 21:59:33 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9c04d06d

sys-libs/glibc-2.29-r2: sparc stable, bug 685818

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 8165b300294..5352ae1f92b 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -20,7 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 ~riscv s390 sh ~sparc x86"
+	KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 ~riscv s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-09-25  8:04 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-09-25  8:04 UTC (permalink / raw
  To: gentoo-commits

commit:     e14229b10b513a164f8379ff14cc8c644c071f27
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 25 07:27:26 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Sep 25 08:04:44 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e14229b1

sys-libs/glibc: drop prepallstrip, bug #587296

Stop using internal portage's 'prepallstrip' helper.
This effectively reverts https://bugs.gentoo.org/46186.
Modern gdb can inspect threads without debugging symbols
in libpthread/libthread_db.

Reported-by: Michał Górny
Closes: https://bugs.gentoo.org/587296
Bug: https://bugs.gentoo.org/46186
Package-Manager: Portage-2.3.76, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild  | 19 -------------------
 sys-libs/glibc/glibc-2.24-r4.ebuild  |  3 +--
 sys-libs/glibc/glibc-2.25-r11.ebuild |  3 +--
 sys-libs/glibc/glibc-2.26-r7.ebuild  |  4 +---
 sys-libs/glibc/glibc-2.27-r6.ebuild  | 19 -------------------
 sys-libs/glibc/glibc-2.28-r6.ebuild  | 19 -------------------
 sys-libs/glibc/glibc-2.29-r2.ebuild  | 19 -------------------
 sys-libs/glibc/glibc-2.29-r4.ebuild  | 19 -------------------
 sys-libs/glibc/glibc-2.29-r5.ebuild  | 19 -------------------
 sys-libs/glibc/glibc-2.30-r1.ebuild  | 20 --------------------
 sys-libs/glibc/glibc-2.30.ebuild     | 20 --------------------
 sys-libs/glibc/glibc-9999.ebuild     |  5 -----
 12 files changed, 3 insertions(+), 166 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index 42ed9d4e04d..75f849f69dc 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -9,7 +9,6 @@ inherit prefix eutils toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
 SLOT="2.2"
 
 EMULTILIB_PKG="true"
@@ -1197,23 +1196,6 @@ glibc_headers_install() {
 	dosym usr/include $(alt_prefix)/sys-include
 }
 
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"/*/libpthread-*.so
-	fi
-}
-
 src_install() {
 	if just_headers ; then
 		export ABI=default
@@ -1222,7 +1204,6 @@ src_install() {
 	fi
 
 	foreach_abi glibc_do_src_install
-	src_strip
 }
 
 # Simple test to make sure our new glibc isn't completely broken.

diff --git a/sys-libs/glibc/glibc-2.24-r4.ebuild b/sys-libs/glibc/glibc-2.24-r4.ebuild
index 40f30a0b8eb..b808611bd31 100644
--- a/sys-libs/glibc/glibc-2.24-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.24-r4.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="5"
@@ -10,7 +10,6 @@ HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 
 # Configuration variables

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index 67c8f98ebb7..e2a0f9131bb 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="5"
@@ -10,7 +10,6 @@ HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
 KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
-RESTRICT="strip" # strip ourself #46186
 EMULTILIB_PKG="true"
 
 # Configuration variables

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index 7caf7ba188c..bfbe9b01b03 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Authors
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -9,7 +9,6 @@ DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
 
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
 EMULTILIB_PKG="true"
 
 # Configuration variables
@@ -784,7 +783,6 @@ src_install() {
 	fi
 
 	foreach_abi glibc_do_src_install
-	src_strip
 }
 
 pkg_preinst() {

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index fc6931ffb7c..42be8144de4 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -9,7 +9,6 @@ inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig usr-lds
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
 SLOT="2.2"
 
 EMULTILIB_PKG="true"
@@ -1303,23 +1302,6 @@ glibc_headers_install() {
 	dosym usr/include $(alt_prefix)/sys-include
 }
 
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
 src_install() {
 	if just_headers ; then
 		export ABI=default
@@ -1328,7 +1310,6 @@ src_install() {
 	fi
 
 	foreach_abi glibc_do_src_install
-	src_strip
 }
 
 # Simple test to make sure our new glibc isn't completely broken.

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index 761c007900b..d40991f16ab 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -9,7 +9,6 @@ inherit prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig usr-ldscr
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
 SLOT="2.2"
 
 EMULTILIB_PKG="true"
@@ -1301,23 +1300,6 @@ glibc_headers_install() {
 	dosym usr/include $(alt_prefix)/sys-include
 }
 
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
 src_install() {
 	if just_headers ; then
 		export ABI=default
@@ -1326,7 +1308,6 @@ src_install() {
 	fi
 
 	foreach_abi glibc_do_src_install
-	src_strip
 }
 
 # Simple test to make sure our new glibc isn't completely broken.

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 5352ae1f92b..b80ddd00814 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -11,7 +11,6 @@ inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuco
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
 SLOT="2.2"
 
 EMULTILIB_PKG="true"
@@ -1343,23 +1342,6 @@ glibc_headers_install() {
 	dosym usr/include $(alt_prefix)/sys-include
 }
 
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
 src_install() {
 	if just_headers ; then
 		export ABI=default
@@ -1368,7 +1350,6 @@ src_install() {
 	fi
 
 	foreach_abi glibc_do_src_install
-	src_strip
 }
 
 # Simple test to make sure our new glibc isn't completely broken.

diff --git a/sys-libs/glibc/glibc-2.29-r4.ebuild b/sys-libs/glibc/glibc-2.29-r4.ebuild
index c49d8263726..7282d89d8ee 100644
--- a/sys-libs/glibc/glibc-2.29-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r4.ebuild
@@ -11,7 +11,6 @@ inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuco
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
 SLOT="2.2"
 
 EMULTILIB_PKG="true"
@@ -1356,23 +1355,6 @@ glibc_headers_install() {
 	dosym usr/include $(alt_prefix)/sys-include
 }
 
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
 src_install() {
 	if just_headers ; then
 		export ABI=default
@@ -1381,7 +1363,6 @@ src_install() {
 	fi
 
 	foreach_abi glibc_do_src_install
-	src_strip
 }
 
 # Simple test to make sure our new glibc isn't completely broken.

diff --git a/sys-libs/glibc/glibc-2.29-r5.ebuild b/sys-libs/glibc/glibc-2.29-r5.ebuild
index d02d0fcb97d..1c3f4a15dde 100644
--- a/sys-libs/glibc/glibc-2.29-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r5.ebuild
@@ -11,7 +11,6 @@ inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuco
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
 SLOT="2.2"
 
 EMULTILIB_PKG="true"
@@ -1356,23 +1355,6 @@ glibc_headers_install() {
 	dosym usr/include $(alt_prefix)/sys-include
 }
 
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
 src_install() {
 	if just_headers ; then
 		export ABI=default
@@ -1381,7 +1363,6 @@ src_install() {
 	fi
 
 	foreach_abi glibc_do_src_install
-	src_strip
 }
 
 # Simple test to make sure our new glibc isn't completely broken.

diff --git a/sys-libs/glibc/glibc-2.30-r1.ebuild b/sys-libs/glibc/glibc-2.30-r1.ebuild
index 2846ee6a61c..b3da5c0345e 100644
--- a/sys-libs/glibc/glibc-2.30-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r1.ebuild
@@ -11,7 +11,6 @@ inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuco
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
 SLOT="2.2"
 
 EMULTILIB_PKG="true"
@@ -1363,23 +1362,6 @@ glibc_headers_install() {
 	dosym usr/include $(alt_prefix)/sys-include
 }
 
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
 src_install() {
 	if just_headers ; then
 		export ABI=default
@@ -1393,8 +1375,6 @@ src_install() {
 		elog "Not installing static glibc libraries"
 		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
 	fi
-
-	src_strip
 }
 
 # Simple test to make sure our new glibc isn't completely broken.

diff --git a/sys-libs/glibc/glibc-2.30.ebuild b/sys-libs/glibc/glibc-2.30.ebuild
index 743f14c253d..5a8933d5d96 100644
--- a/sys-libs/glibc/glibc-2.30.ebuild
+++ b/sys-libs/glibc/glibc-2.30.ebuild
@@ -11,7 +11,6 @@ inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuco
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-RESTRICT="strip" # Strip ourself #46186
 SLOT="2.2"
 
 EMULTILIB_PKG="true"
@@ -1363,23 +1362,6 @@ glibc_headers_install() {
 	dosym usr/include $(alt_prefix)/sys-include
 }
 
-src_strip() {
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread, so we need to strip it by hand.  libthread_db makes no
-	# sense stripped as it is only used when debugging.
-	local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
-	env \
-		-uRESTRICT \
-		CHOST=${CTARGET} \
-		STRIP_MASK="/*/{,tls/}${pthread}*" \
-		prepallstrip
-	# if user has stripping enabled and does not have split debug turned on,
-	# then leave the debugging sections in libpthread.
-	if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
-		${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so
-	fi
-}
-
 src_install() {
 	if just_headers ; then
 		export ABI=default
@@ -1393,8 +1375,6 @@ src_install() {
 		elog "Not installing static glibc libraries"
 		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
 	fi
-
-	src_strip
 }
 
 # Simple test to make sure our new glibc isn't completely broken.

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index cd66539a922..d529e346178 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1181,11 +1181,6 @@ glibc_do_src_install() {
 	# '#define VERSION "2.26.90"' -> '2.26.90'
 	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
 
-	# gdb is lame and requires some debugging information to remain in
-	# libpthread.  libthread_db makes no sense stripped as it is only used when debugging.
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	dostrip -x $(alt_libdir)/libthread_db-1.0.so
-
 	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
 		# Move versioned .a file out of libdir to evade portage QA checks
 		# instead of using gen_usr_ldscript(). We fix ldscript as:


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-10-12 20:03 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-10-12 20:03 UTC (permalink / raw
  To: gentoo-commits

commit:     a56243ab61dd2088eaa21a45cbdb574505a28f6c
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 19:49:16 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 20:03:05 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a56243ab

sys-libs/glibc: allow glibc dongrade on I_ALLOW_TO_BREAK_MY_SYSTEM

Package-Manager: Portage-2.3.76, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild | 2 +-
 sys-libs/glibc/glibc-2.26-r7.ebuild | 2 +-
 sys-libs/glibc/glibc-2.27-r6.ebuild | 2 +-
 sys-libs/glibc/glibc-2.28-r6.ebuild | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index 75f849f69dc..0fedbb8e940 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -539,7 +539,7 @@ sanity_prechecks() {
 		if has_version ">${CATEGORY}/${P}-r10000" ; then
 			eerror "Sanity check to keep you from breaking your system:"
 			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
 		fi
 
 		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index bfbe9b01b03..34d8fb8a7ac 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -122,7 +122,7 @@ pkg_pretend() {
 		if has_version ">${CATEGORY}/${P}-r10000" ; then
 			eerror "Sanity check to keep you from breaking your system:"
 			eerror " Downgrading glibc is not supported and a sure way to destruction"
-			die "Aborting to save your system"
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
 		fi
 
 		if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 42be8144de4..f1409e36cf3 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -607,7 +607,7 @@ sanity_prechecks() {
 		if has_version ">${CATEGORY}/${P}-r10000" ; then
 			eerror "Sanity check to keep you from breaking your system:"
 			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
 		fi
 
 		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index d40991f16ab..aa318b7e0f1 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -598,7 +598,7 @@ sanity_prechecks() {
 		if has_version ">${CATEGORY}/${P}-r10000" ; then
 			eerror "Sanity check to keep you from breaking your system:"
 			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			die "Aborting to save your system."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
 		fi
 
 		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-10-14  6:58 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-10-14  6:58 UTC (permalink / raw
  To: gentoo-commits

commit:     650d70eb5d91265329e2f730bc1aed0fa5863db6
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 14 06:57:44 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon Oct 14 06:58:05 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=650d70eb

sys-libs/glibc: disable stripping for cross-glibc

commit e14229b10b513a164f8379ff14cc8c644c071f27 dropped
special stripping and relied on standard ${CHOST}-strip.

Unfortunately one special case wa missing:
cross-*/glibc ebuilds use ${CTARGET} as a target and are
installed into the host. That causes ${CHOST}-strip to be
called on ${CTARGET} binaries. If multitarget is not enabled
strip either breaks such bianries or makes them untouched.

Disable tripping until we migrated off off cross-*/glibc ebuilds.

Reported-by:  Johannes Geiss
Closes: https://bugs.gentoo.org/697428
Package-Manager: Portage-2.3.76, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild  | 3 +++
 sys-libs/glibc/glibc-2.24-r4.ebuild  | 3 +++
 sys-libs/glibc/glibc-2.25-r11.ebuild | 3 +++
 sys-libs/glibc/glibc-2.26-r7.ebuild  | 3 +++
 sys-libs/glibc/glibc-2.27-r6.ebuild  | 3 +++
 sys-libs/glibc/glibc-2.28-r6.ebuild  | 3 +++
 sys-libs/glibc/glibc-2.29-r2.ebuild  | 3 +++
 sys-libs/glibc/glibc-2.29-r4.ebuild  | 3 +++
 sys-libs/glibc/glibc-2.29-r5.ebuild  | 3 +++
 sys-libs/glibc/glibc-2.30-r1.ebuild  | 3 +++
 sys-libs/glibc/glibc-2.30.ebuild     | 3 +++
 sys-libs/glibc/glibc-9999.ebuild     | 3 +++
 12 files changed, 36 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index 0fedbb8e940..20b236f9037 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -56,6 +56,9 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
+		# portage's attempt to strip breaks non-native bianries
+		# at least on arm: bug #697428
+		RESTRICT=strip
 	fi
 fi
 

diff --git a/sys-libs/glibc/glibc-2.24-r4.ebuild b/sys-libs/glibc/glibc-2.24-r4.ebuild
index b808611bd31..4c862498855 100644
--- a/sys-libs/glibc/glibc-2.24-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.24-r4.ebuild
@@ -49,6 +49,9 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
+		# portage's attempt to strip breaks non-native bianries
+		# at least on arm: bug #697428
+		RESTRICT=strip
 	fi
 fi
 

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index e2a0f9131bb..4b3ac83a890 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -51,6 +51,9 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
+		# portage's attempt to strip breaks non-native bianries
+		# at least on arm: bug #697428
+		RESTRICT=strip
 	fi
 fi
 

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index 34d8fb8a7ac..80530db6e45 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -55,6 +55,9 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
+		# portage's attempt to strip breaks non-native bianries
+		# at least on arm: bug #697428
+		RESTRICT=strip
 	fi
 fi
 

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index f1409e36cf3..2b333181bf7 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -55,6 +55,9 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
+		# portage's attempt to strip breaks non-native bianries
+		# at least on arm: bug #697428
+		RESTRICT=strip
 	fi
 fi
 

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index aa318b7e0f1..2a512a62aec 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -55,6 +55,9 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
+		# portage's attempt to strip breaks non-native bianries
+		# at least on arm: bug #697428
+		RESTRICT=strip
 	fi
 fi
 

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index b80ddd00814..bd08c9a208a 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -57,6 +57,9 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
+		# portage's attempt to strip breaks non-native bianries
+		# at least on arm: bug #697428
+		RESTRICT=strip
 	fi
 fi
 

diff --git a/sys-libs/glibc/glibc-2.29-r4.ebuild b/sys-libs/glibc/glibc-2.29-r4.ebuild
index 7282d89d8ee..0f388a106c6 100644
--- a/sys-libs/glibc/glibc-2.29-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r4.ebuild
@@ -57,6 +57,9 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
+		# portage's attempt to strip breaks non-native bianries
+		# at least on arm: bug #697428
+		RESTRICT=strip
 	fi
 fi
 

diff --git a/sys-libs/glibc/glibc-2.29-r5.ebuild b/sys-libs/glibc/glibc-2.29-r5.ebuild
index 1c3f4a15dde..6ac0497d07c 100644
--- a/sys-libs/glibc/glibc-2.29-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r5.ebuild
@@ -57,6 +57,9 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
+		# portage's attempt to strip breaks non-native bianries
+		# at least on arm: bug #697428
+		RESTRICT=strip
 	fi
 fi
 

diff --git a/sys-libs/glibc/glibc-2.30-r1.ebuild b/sys-libs/glibc/glibc-2.30-r1.ebuild
index b3da5c0345e..51bf1cbd9f3 100644
--- a/sys-libs/glibc/glibc-2.30-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r1.ebuild
@@ -58,6 +58,9 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
+		# portage's attempt to strip breaks non-native bianries
+		# at least on arm: bug #697428
+		RESTRICT=strip
 	fi
 fi
 

diff --git a/sys-libs/glibc/glibc-2.30.ebuild b/sys-libs/glibc/glibc-2.30.ebuild
index 5a8933d5d96..544eec7b687 100644
--- a/sys-libs/glibc/glibc-2.30.ebuild
+++ b/sys-libs/glibc/glibc-2.30.ebuild
@@ -58,6 +58,9 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
+		# portage's attempt to strip breaks non-native bianries
+		# at least on arm: bug #697428
+		RESTRICT=strip
 	fi
 fi
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index d529e346178..6894e04b796 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -58,6 +58,9 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
+		# portage's attempt to strip breaks non-native bianries
+		# at least on arm: bug #697428
+		RESTRICT=strip
 	fi
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-10-17 23:22 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-10-17 23:22 UTC (permalink / raw
  To: gentoo-commits

commit:     f3872a506edc7da0d987bcf0a90d4709945328a7
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 17 23:19:20 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Oct 17 23:22:21 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f3872a50

sys-libs/glibc: restore strip quirk for 'libpthread.so.0'

This change effectively reverts commit e14229b10b513a
("sys-libs/glibc: drop prepallstrip, bug #587296")

gdb still relies on libpthread being unstripped.
See https://bugs.gentoo.org/697910 for details and reproducer.

Also see ebuild note that explains indirect mechanics
of how glibc relies on gdb's ability to traverse local symbols.

In EAPI=7 ebuilds (glibc-9999) we do selective stripping.

Reported-by: Minux
Closes: https://bugs.gentoo.org/697910
Bug: https://bugs.gentoo.org/587296
Bug: https://bugs.gentoo.org/46186
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
Package-Manager: Portage-2.3.76, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild  | 25 ++++++++++++++++++++++---
 sys-libs/glibc/glibc-2.24-r4.ebuild  | 25 ++++++++++++++++++++++---
 sys-libs/glibc/glibc-2.25-r11.ebuild | 25 ++++++++++++++++++++++---
 sys-libs/glibc/glibc-2.26-r7.ebuild  | 25 ++++++++++++++++++++++---
 sys-libs/glibc/glibc-2.27-r6.ebuild  | 25 ++++++++++++++++++++++---
 sys-libs/glibc/glibc-2.28-r6.ebuild  | 25 ++++++++++++++++++++++---
 sys-libs/glibc/glibc-2.29-r2.ebuild  | 25 ++++++++++++++++++++++---
 sys-libs/glibc/glibc-2.29-r4.ebuild  | 25 ++++++++++++++++++++++---
 sys-libs/glibc/glibc-2.29-r5.ebuild  | 25 ++++++++++++++++++++++---
 sys-libs/glibc/glibc-2.30-r1.ebuild  | 25 ++++++++++++++++++++++---
 sys-libs/glibc/glibc-2.30.ebuild     | 25 ++++++++++++++++++++++---
 sys-libs/glibc/glibc-9999.ebuild     | 31 ++++++++++++++++++++++++++++---
 12 files changed, 270 insertions(+), 36 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index 20b236f9037..de97f115887 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -56,12 +56,31 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
-		# portage's attempt to strip breaks non-native bianries
-		# at least on arm: bug #697428
-		RESTRICT=strip
 	fi
 fi
 
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we disable stripping
+# entirely.
+RESTRICT=strip
+
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS.
 COMMON_DEPEND="

diff --git a/sys-libs/glibc/glibc-2.24-r4.ebuild b/sys-libs/glibc/glibc-2.24-r4.ebuild
index 4c862498855..6e4b70cd46d 100644
--- a/sys-libs/glibc/glibc-2.24-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.24-r4.ebuild
@@ -49,12 +49,31 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
-		# portage's attempt to strip breaks non-native bianries
-		# at least on arm: bug #697428
-		RESTRICT=strip
 	fi
 fi
 
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we disable stripping
+# entirely.
+RESTRICT=strip
+
 is_crosscompile() {
 	[[ ${CHOST} != ${CTARGET} ]]
 }

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index 4b3ac83a890..0f544aa3101 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -51,12 +51,31 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
-		# portage's attempt to strip breaks non-native bianries
-		# at least on arm: bug #697428
-		RESTRICT=strip
 	fi
 fi
 
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we disable stripping
+# entirely.
+RESTRICT=strip
+
 is_crosscompile() {
 	[[ ${CHOST} != ${CTARGET} ]]
 }

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index 80530db6e45..ebe70b6e3ea 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -55,12 +55,31 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
-		# portage's attempt to strip breaks non-native bianries
-		# at least on arm: bug #697428
-		RESTRICT=strip
 	fi
 fi
 
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we disable stripping
+# entirely.
+RESTRICT=strip
+
 is_crosscompile() {
 	[[ ${CHOST} != ${CTARGET} ]]
 }

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 2b333181bf7..8815d7bc623 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -55,12 +55,31 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
-		# portage's attempt to strip breaks non-native bianries
-		# at least on arm: bug #697428
-		RESTRICT=strip
 	fi
 fi
 
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we disable stripping
+# entirely.
+RESTRICT=strip
+
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS.
 COMMON_DEPEND="

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index 2a512a62aec..7412d5dfc5c 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -55,12 +55,31 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
-		# portage's attempt to strip breaks non-native bianries
-		# at least on arm: bug #697428
-		RESTRICT=strip
 	fi
 fi
 
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we disable stripping
+# entirely.
+RESTRICT=strip
+
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,
 # and that gcc already contains the hardened patches.

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index bd08c9a208a..a09890ee70a 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -57,12 +57,31 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
-		# portage's attempt to strip breaks non-native bianries
-		# at least on arm: bug #697428
-		RESTRICT=strip
 	fi
 fi
 
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we disable stripping
+# entirely.
+RESTRICT=strip
+
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,
 # and that gcc already contains the hardened patches.

diff --git a/sys-libs/glibc/glibc-2.29-r4.ebuild b/sys-libs/glibc/glibc-2.29-r4.ebuild
index 0f388a106c6..f25792a193d 100644
--- a/sys-libs/glibc/glibc-2.29-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r4.ebuild
@@ -57,12 +57,31 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
-		# portage's attempt to strip breaks non-native bianries
-		# at least on arm: bug #697428
-		RESTRICT=strip
 	fi
 fi
 
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we disable stripping
+# entirely.
+RESTRICT=strip
+
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,
 # and that gcc already contains the hardened patches.

diff --git a/sys-libs/glibc/glibc-2.29-r5.ebuild b/sys-libs/glibc/glibc-2.29-r5.ebuild
index 6ac0497d07c..5ef228c3688 100644
--- a/sys-libs/glibc/glibc-2.29-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r5.ebuild
@@ -57,12 +57,31 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
-		# portage's attempt to strip breaks non-native bianries
-		# at least on arm: bug #697428
-		RESTRICT=strip
 	fi
 fi
 
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we disable stripping
+# entirely.
+RESTRICT=strip
+
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,
 # and that gcc already contains the hardened patches.

diff --git a/sys-libs/glibc/glibc-2.30-r1.ebuild b/sys-libs/glibc/glibc-2.30-r1.ebuild
index 51bf1cbd9f3..958a2c87cde 100644
--- a/sys-libs/glibc/glibc-2.30-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r1.ebuild
@@ -58,12 +58,31 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
-		# portage's attempt to strip breaks non-native bianries
-		# at least on arm: bug #697428
-		RESTRICT=strip
 	fi
 fi
 
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we disable stripping
+# entirely.
+RESTRICT=strip
+
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,
 # and that gcc already contains the hardened patches.

diff --git a/sys-libs/glibc/glibc-2.30.ebuild b/sys-libs/glibc/glibc-2.30.ebuild
index 544eec7b687..452fcda36fd 100644
--- a/sys-libs/glibc/glibc-2.30.ebuild
+++ b/sys-libs/glibc/glibc-2.30.ebuild
@@ -58,12 +58,31 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
-		# portage's attempt to strip breaks non-native bianries
-		# at least on arm: bug #697428
-		RESTRICT=strip
 	fi
 fi
 
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we disable stripping
+# entirely.
+RESTRICT=strip
+
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,
 # and that gcc already contains the hardened patches.

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 6894e04b796..d1ad8e513fb 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -58,12 +58,30 @@ export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
 	if [[ ${CATEGORY} == cross-* ]] ; then
 		export CTARGET=${CATEGORY#cross-}
-		# portage's attempt to strip breaks non-native bianries
-		# at least on arm: bug #697428
-		RESTRICT=strip
 	fi
 fi
 
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+RESTRICT=strip
+
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,
 # and that gcc already contains the hardened patches.
@@ -1184,6 +1202,13 @@ glibc_do_src_install() {
 	# '#define VERSION "2.26.90"' -> '2.26.90'
 	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
 
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile || dostrip /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
 	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
 		# Move versioned .a file out of libdir to evade portage QA checks
 		# instead of using gen_usr_ldscript(). We fix ldscript as:


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-10-18  6:47 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-10-18  6:47 UTC (permalink / raw
  To: gentoo-commits

commit:     629fb0560bffdf39a923c6ee794eddfb815db579
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 18 06:46:54 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Oct 18 06:47:16 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=629fb056

sys-libs/glibc: avoid RESTRICT=strip and use 'dostrip -x /'

RESTRICT=strip + 'dostrip /' does not have a desired effect
of enabling (possibly selective) stripping in portage:
https://bugs.gentoo.org/697960

Workaround it by using 'if foo && dostrip -x /' instead of
RESTRICT=strip + 'if foo || dostrip /'.

Reported-by: Arfrever Frehtes Taifersar Arahesis
Fixed-by: Arfrever Frehtes Taifersar Arahesis
Package-Manager: Portage-2.3.76, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index d1ad8e513fb..08a4eba83b3 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -80,7 +80,6 @@ fi
 #   losing it's '.symtab' entries.
 # As Gentoo's strip does not allow us to pass less aggressive stripping
 # options and does not check the machine target we strip selectively.
-RESTRICT=strip
 
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,
@@ -1204,7 +1203,7 @@ glibc_do_src_install() {
 
 	# Avoid stripping binaries not targeted by ${CHOST}. Or else
 	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile || dostrip /
+	is_crosscompile && dostrip -x /
 	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
 	# See Note [Disable automatic stripping]
 	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-10-19  9:37 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-10-19  9:37 UTC (permalink / raw
  To: gentoo-commits

commit:     d50c41441416de4df06860ba352c5db86a254eee
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 19 09:28:27 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Oct 19 09:36:48 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d50c4144

sys-libs/glibc: update 2.29 branch to EAPI=7

Main goal is to backport selective stripping.

Package-Manager: Portage-2.3.76, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r6.ebuild | 1479 +++++++++++++++++++++++++++++++++++
 1 file changed, 1479 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.29-r6.ebuild b/sys-libs/glibc/glibc-2.29-r6.ebuild
new file mode 100644
index 00000000000..ef799b4a3ae
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.29-r6.ebuild
@@ -0,0 +1,1479 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{5,6,7} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=6
+
+SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+	!sys-kernel/ps3-sources
+	!sys-libs/nss-db
+"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.0.5
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake -s glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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' 2>/dev/null ; then
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		amd64)
+			# -march needed for #185404 #199334
+			# Note: This test only matters when the x86 ABI is enabled, so we could
+			# optimize a bit and elide it.
+			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparc64v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparcv9v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Over-zealous CFLAGS can often cause problems.  What may work for one
+	# person may not work for another.  To avoid a large influx of bugs
+	# relating to failed builds, we strip most CFLAGS out to ensure as few
+	# problems as possible.
+	strip-flags
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# Lock glibc at -O2; we want to be conservative here.
+	# -fno-strict-aliasing is to work around #155906.
+	filter-flags '-O?'
+	append-flags -O2 -fno-strict-aliasing
+
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ -n ${ROOT} ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=$(usex ssp all no) )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-10-19  9:37 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-10-19  9:37 UTC (permalink / raw
  To: gentoo-commits

commit:     5f4d3d14fcb9cf47d39b0fe8674b17ad3543c35d
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 19 09:35:20 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Oct 19 09:36:56 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5f4d3d14

sys-libs/glibc: add ~riscv for 2.30 and above

Package-Manager: Portage-2.3.76, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r2.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30-r2.ebuild b/sys-libs/glibc/glibc-2.30-r2.ebuild
index f726bd6b88c..c3900e1d6a3 100644
--- a/sys-libs/glibc/glibc-2.30-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r2.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
 	KEYWORDS=""
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 08a4eba83b3..4ff0c140c45 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
 	KEYWORDS=""
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-10-19  9:37 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-10-19  9:37 UTC (permalink / raw
  To: gentoo-commits

commit:     23d1c015230d9ff44bcdd7b72e00ca3533815fa4
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 19 09:30:32 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Oct 19 09:36:54 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=23d1c015

sys-libs/glibc: drop old

Package-Manager: Portage-2.3.76, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 -
 sys-libs/glibc/glibc-2.29-r4.ebuild | 1476 ----------------------------------
 sys-libs/glibc/glibc-2.30.ebuild    | 1484 -----------------------------------
 3 files changed, 2962 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index e8f7dda1268..51b573c39d2 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -13,10 +13,8 @@ DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea
 DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 4ab583be712994f949dee2512da6e12fd7f7ad73e96393f21678552b43da98f49321b53b5b009551300cdb09ca135e7f6adc636ff750c251a1d6d7f262dbc410 SHA512 e3f40ae6e9d06471c1a11bd2bce7b5161d07c3d0a81791505a72aec4817e7faf9ef09841e98c6dcf62a0a00754dff87dd194d97ac6b6354aeb2497cf60900b96
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525eccfec462d638dbc25c581e5b7a2a72ffd5191842f5ac443a868cbc950838d7e5120e866d343a14b80c55dcbfa48f30 SHA512 4c9b78d9d1a8aa629418f2d758ef800857780b8a1fd8d3582b88348a513ca26ca7f6ac9110a8c6bae16949b360ba36840d184f42293cd4324760273592d1b438
-DIST glibc-2.29-patches-5.tar.xz 64032 BLAKE2B 6c3104bd80aaba617201812a631b734ded4b02f8d4dadb5e353af48692f2a1509ddae1d34098de913ae5b3ac1a29111a44dfae71c3024fab4a805a22e9d66e33 SHA512 39add1388268ecf2029cb90b8312fb610b203f459a092dc1da8b46ce91ccfbbdff235592aa6174edf9efe71039d984ee121dc9adf7e18490cf92fe24561b1267
 DIST glibc-2.29-patches-6.tar.xz 64076 BLAKE2B 04c1baf838eff9275e79145d4a5a642dcd6572aadcdfc6782769f2de107dcd1648b81d0690068db8c0d53229efe2130e279f4aafe8a91238e5dd6a8a7120a433 SHA512 6494dcd23441fe308de97706f7abbea1571e0015d1456e719268b8026e1fb23733c2efd5256840f4b9f0df4f02ac7827b1fad56905cbd8919bca9c25b0afe822
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
-DIST glibc-2.30-patches-1.tar.xz 19364 BLAKE2B 853ae651cf48a78796ac0a3c9c84098731d5a43b37644ee5029d2e2b06dab0d1d96b9dd7c3fd896c5513f5f712beca13845c1e24c698fe824ce0f529a2a827d4 SHA512 23065ec67b1a6302eece79da1ba731aa158a2abc0c65aed755cafea388c19aa1f545a6ea6d9db1fd128d06c6878b4c73aea07c6acc053b56bc416143e96e1c05
 DIST glibc-2.30-patches-2.tar.xz 19588 BLAKE2B 672343ef8a44486304f03091844635febef9d1bc8000ab3382d702dcc1111a107b5e758355beaef8db5012f7e324e4c2365e10fc642b01c9f9a3a315de2dc7f6 SHA512 494155147b56e094a4427aed79e278b4a350928ddaff84330d6a40fad079131a4574f20c591dc95e572391b68ef72c49790571ee5323a2a541ec0757bcaeb161
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-9999-patches-14.tar.xz 17908 BLAKE2B a6e1f22a4358111ff757431c5d42fd020f6095584c3517aa854ea266129d1a177a7c09b310643f1cea32ffaf253806ac08f3aed864fb477097aaa2c4010450f4 SHA512 ef28b409b26472ec1d868167345aecfee70b1edf1863374dc2f25892f40c10f0826620a8b22fbbc9f737c8f611569b3412e8e2ea041da1ad1ef7f6398b82cddc

diff --git a/sys-libs/glibc/glibc-2.29-r4.ebuild b/sys-libs/glibc/glibc-2.29-r4.ebuild
deleted file mode 100644
index f25792a193d..00000000000
--- a/sys-libs/glibc/glibc-2.29-r4.ebuild
+++ /dev/null
@@ -1,1476 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-PYTHON_COMPAT=( python3_{5,6,7} )
-
-inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=5
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we disable stripping
-# entirely.
-RESTRICT=strip
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-		virtual/os-headers
-	"
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all no) )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	local locale_list="${root}/etc/locale.gen"
-
-	pushd "${ED}"/$(get_libdir)
-
-	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"
-	fi
-
-	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-
-	popd
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.30.ebuild b/sys-libs/glibc/glibc-2.30.ebuild
deleted file mode 100644
index 452fcda36fd..00000000000
--- a/sys-libs/glibc/glibc-2.30.ebuild
+++ /dev/null
@@ -1,1484 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-PYTHON_COMPAT=( python3_{5,6,7} )
-
-inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=1
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we disable stripping
-# entirely.
-RESTRICT=strip
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-		virtual/os-headers
-	"
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all no) )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-10-19  9:37 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-10-19  9:37 UTC (permalink / raw
  To: gentoo-commits

commit:     7d756d637c7221bcf874e7d6b702ceaade3cd45d
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 19 09:21:57 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Oct 19 09:36:47 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7d756d63

sys-libs/glibc: update 2.30 branch to EAPI=7

Main goal is to backport selective stripping.

Package-Manager: Portage-2.3.76, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r2.ebuild | 1491 +++++++++++++++++++++++++++++++++++
 1 file changed, 1491 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.30-r2.ebuild b/sys-libs/glibc/glibc-2.30-r2.ebuild
new file mode 100644
index 00000000000..f726bd6b88c
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.30-r2.ebuild
@@ -0,0 +1,1491 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{5,6,7} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+	KEYWORDS=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=2
+
+SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-apps/sandbox-1.6
+	!<sys-apps/portage-2.1.2
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+	!sys-kernel/ps3-sources
+	!sys-libs/nss-db
+"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.0.5
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake -s glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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' 2>/dev/null ; then
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		amd64)
+			# -march needed for #185404 #199334
+			# Note: This test only matters when the x86 ABI is enabled, so we could
+			# optimize a bit and elide it.
+			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparc64v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparcv9v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ -n ${ROOT} ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=$(usex ssp all no) )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-10-22 18:07 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-10-22 18:07 UTC (permalink / raw
  To: gentoo-commits

commit:     c8f2c70c47446347c9a9e382c4015be3736e4dc3
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 22 18:07:23 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Oct 22 18:07:46 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8f2c70c

sys-libs/glibc: fix riscv build against linux-headers-5.3

Package-Manager: Portage-2.3.76, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest             | 2 ++
 sys-libs/glibc/glibc-2.29-r6.ebuild | 2 +-
 sys-libs/glibc/glibc-2.30-r2.ebuild | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 51b573c39d2..29063c59469 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,7 +14,9 @@ DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 4ab583be712994f949dee2512da6e12fd
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525eccfec462d638dbc25c581e5b7a2a72ffd5191842f5ac443a868cbc950838d7e5120e866d343a14b80c55dcbfa48f30 SHA512 4c9b78d9d1a8aa629418f2d758ef800857780b8a1fd8d3582b88348a513ca26ca7f6ac9110a8c6bae16949b360ba36840d184f42293cd4324760273592d1b438
 DIST glibc-2.29-patches-6.tar.xz 64076 BLAKE2B 04c1baf838eff9275e79145d4a5a642dcd6572aadcdfc6782769f2de107dcd1648b81d0690068db8c0d53229efe2130e279f4aafe8a91238e5dd6a8a7120a433 SHA512 6494dcd23441fe308de97706f7abbea1571e0015d1456e719268b8026e1fb23733c2efd5256840f4b9f0df4f02ac7827b1fad56905cbd8919bca9c25b0afe822
+DIST glibc-2.29-patches-7.tar.xz 64752 BLAKE2B 766f3f2d11aedf7e1b83db94fd2793244e29abc0beb78071a3eadfb83d3589f56b07b68c8faffd77ecc859497ba52f0327e03cf984b00adbeee3e196b0c5e57c SHA512 aea61fd3e084b293d0a92c89cd83d176ca95112e23224091e31ac77f54089922926ebbd9b75748d5b750f3d88c6f55f9953f11375a07a219946c485d4bf6bcaf
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-2.tar.xz 19588 BLAKE2B 672343ef8a44486304f03091844635febef9d1bc8000ab3382d702dcc1111a107b5e758355beaef8db5012f7e324e4c2365e10fc642b01c9f9a3a315de2dc7f6 SHA512 494155147b56e094a4427aed79e278b4a350928ddaff84330d6a40fad079131a4574f20c591dc95e572391b68ef72c49790571ee5323a2a541ec0757bcaeb161
+DIST glibc-2.30-patches-3.tar.xz 20412 BLAKE2B 8cd588284bf07985262a0289d8cbae03b0a75c48110fed6152c0431dc4f729a9695df910b1521a6072e9736b26145bf372d5b60163f64f4556f17f2f9f223e11 SHA512 0da9107518117a1cf901d282f2b84a2f4780130ab9eb7025ffd8b7e629aa6fd5f05b293dd49fc3c300bc2e74e7f81fc1f8a7cb12428b2be086a160d429715758
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-9999-patches-14.tar.xz 17908 BLAKE2B a6e1f22a4358111ff757431c5d42fd020f6095584c3517aa854ea266129d1a177a7c09b310643f1cea32ffaf253806ac08f3aed864fb477097aaa2c4010450f4 SHA512 ef28b409b26472ec1d868167345aecfee70b1edf1863374dc2f25892f40c10f0826620a8b22fbbc9f737c8f611569b3412e8e2ea041da1ad1ef7f6398b82cddc

diff --git a/sys-libs/glibc/glibc-2.29-r6.ebuild b/sys-libs/glibc/glibc-2.29-r6.ebuild
index ef799b4a3ae..72a38553096 100644
--- a/sys-libs/glibc/glibc-2.29-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r6.ebuild
@@ -28,7 +28,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=6
+PATCH_VER=7
 
 SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"

diff --git a/sys-libs/glibc/glibc-2.30-r2.ebuild b/sys-libs/glibc/glibc-2.30-r2.ebuild
index c3900e1d6a3..238a8290631 100644
--- a/sys-libs/glibc/glibc-2.30-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r2.ebuild
@@ -29,7 +29,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=2
+PATCH_VER=3
 
 SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-11-06 20:10 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-11-06 20:10 UTC (permalink / raw
  To: gentoo-commits

commit:     95fbc62a625a8025f3317e6ddd3b5c431a0968c8
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Nov  6 20:10:23 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Nov  6 20:10:36 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=95fbc62a

sys-libs/glibc: introduce USE=+crypt

Today libcrypt.so.1 is provided by glibc. Eventually glibc will
stop providing it in favoud of external providers like libcrypt.

USE=crypt exposes a knob to disable libcrypt.so.1 installation.
Use at your own risk. There currently is no replacement yet in
Gentoo.

Bug: https://bugs.gentoo.org/699422
Package-Manager: Portage-2.3.78, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r2.ebuild | 3 ++-
 sys-libs/glibc/metadata.xml         | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.30-r2.ebuild b/sys-libs/glibc/glibc-2.30-r2.ebuild
index 238a8290631..c779a813347 100644
--- a/sys-libs/glibc/glibc-2.30-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r2.ebuild
@@ -34,7 +34,7 @@ PATCH_VER=3
 SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps cet compile-locales custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -941,6 +941,7 @@ glibc_do_configure() {
 		--libexecdir='$(libdir)'/misc/glibc
 		--with-bugurl=https://bugs.gentoo.org/
 		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
 		$(use_multiarch || echo --disable-multi-arch)
 		$(use_enable systemtap)
 		$(use_enable nscd)

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index 58d861be030..b00c5f56e58 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -8,6 +8,7 @@
 <use>
  <flag name="cet">Enable Intel Control-flow Enforcement Technology (needs binutils 2.29 and gcc 8)</flag>
  <flag name="compile-locales">build *all* locales in src_install; this is generally meant for stage building only as it ignores /etc/locale.gen file and can be pretty slow</flag>
+ <flag name="crypt">build and install libcrypt and crypt.h</flag>
  <flag name="debug">When USE=hardened, allow fortify/stack violations to dump core (SIGABRT) and not kill self (SIGKILL)</flag>
  <flag name="gd">build memusage and memusagestat tools</flag>
  <flag name="multiarch">enable optimizations for multiple CPU architectures (detected at runtime)</flag>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-11-08 20:43 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-11-08 20:43 UTC (permalink / raw
  To: gentoo-commits

commit:     a129e092b615136d79c27d629f6279c66bf637f2
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  8 20:43:15 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Nov  8 20:43:36 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a129e092

sys-libs/glibc: drop old

Package-Manager: Portage-2.3.78, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.30-r1.ebuild | 1484 -----------------------------------
 2 files changed, 1485 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 29063c59469..cb91c2cf08a 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,7 +16,6 @@ DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525
 DIST glibc-2.29-patches-6.tar.xz 64076 BLAKE2B 04c1baf838eff9275e79145d4a5a642dcd6572aadcdfc6782769f2de107dcd1648b81d0690068db8c0d53229efe2130e279f4aafe8a91238e5dd6a8a7120a433 SHA512 6494dcd23441fe308de97706f7abbea1571e0015d1456e719268b8026e1fb23733c2efd5256840f4b9f0df4f02ac7827b1fad56905cbd8919bca9c25b0afe822
 DIST glibc-2.29-patches-7.tar.xz 64752 BLAKE2B 766f3f2d11aedf7e1b83db94fd2793244e29abc0beb78071a3eadfb83d3589f56b07b68c8faffd77ecc859497ba52f0327e03cf984b00adbeee3e196b0c5e57c SHA512 aea61fd3e084b293d0a92c89cd83d176ca95112e23224091e31ac77f54089922926ebbd9b75748d5b750f3d88c6f55f9953f11375a07a219946c485d4bf6bcaf
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
-DIST glibc-2.30-patches-2.tar.xz 19588 BLAKE2B 672343ef8a44486304f03091844635febef9d1bc8000ab3382d702dcc1111a107b5e758355beaef8db5012f7e324e4c2365e10fc642b01c9f9a3a315de2dc7f6 SHA512 494155147b56e094a4427aed79e278b4a350928ddaff84330d6a40fad079131a4574f20c591dc95e572391b68ef72c49790571ee5323a2a541ec0757bcaeb161
 DIST glibc-2.30-patches-3.tar.xz 20412 BLAKE2B 8cd588284bf07985262a0289d8cbae03b0a75c48110fed6152c0431dc4f729a9695df910b1521a6072e9736b26145bf372d5b60163f64f4556f17f2f9f223e11 SHA512 0da9107518117a1cf901d282f2b84a2f4780130ab9eb7025ffd8b7e629aa6fd5f05b293dd49fc3c300bc2e74e7f81fc1f8a7cb12428b2be086a160d429715758
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-9999-patches-14.tar.xz 17908 BLAKE2B a6e1f22a4358111ff757431c5d42fd020f6095584c3517aa854ea266129d1a177a7c09b310643f1cea32ffaf253806ac08f3aed864fb477097aaa2c4010450f4 SHA512 ef28b409b26472ec1d868167345aecfee70b1edf1863374dc2f25892f40c10f0826620a8b22fbbc9f737c8f611569b3412e8e2ea041da1ad1ef7f6398b82cddc

diff --git a/sys-libs/glibc/glibc-2.30-r1.ebuild b/sys-libs/glibc/glibc-2.30-r1.ebuild
deleted file mode 100644
index 958a2c87cde..00000000000
--- a/sys-libs/glibc/glibc-2.30-r1.ebuild
+++ /dev/null
@@ -1,1484 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-PYTHON_COMPAT=( python3_{5,6,7} )
-
-inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=2
-
-SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we disable stripping
-# entirely.
-RESTRICT=strip
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-apps/sandbox-1.6
-	!<sys-apps/portage-2.1.2
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-		virtual/os-headers
-	"
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all no) )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-11-08 20:43 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-11-08 20:43 UTC (permalink / raw
  To: gentoo-commits

commit:     c0fbcff7b24f844b4be7b6f380a3279a46715ece
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  8 20:42:46 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Nov  8 20:43:35 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c0fbcff7

sys-libs/glibc: unleash glibc-2.30 into ~arch

For commit build failures see:
https://wiki.gentoo.org/wiki/Project:Toolchain#glibc-2.30

Package-Manager: Portage-2.3.78, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r2.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30-r2.ebuild b/sys-libs/glibc/glibc-2.30-r2.ebuild
index c779a813347..0958572b1bd 100644
--- a/sys-libs/glibc/glibc-2.30-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r2.ebuild
@@ -19,8 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-11-10 22:41 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-11-10 22:41 UTC (permalink / raw
  To: gentoo-commits

commit:     3616aae899723b001c0d9a4b6a9051ed3d8f019e
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 10 22:41:36 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Nov 10 22:41:36 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3616aae8

sys-libs/glibc: add RESTRICT="!test? ( test )"

Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.28-r6.ebuild | 2 +-
 sys-libs/glibc/glibc-2.29-r2.ebuild | 2 +-
 sys-libs/glibc/glibc-2.29-r5.ebuild | 2 +-
 sys-libs/glibc/glibc-2.29-r6.ebuild | 2 ++
 sys-libs/glibc/glibc-2.30-r2.ebuild | 2 ++
 sys-libs/glibc/glibc-9999.ebuild    | 2 ++
 6 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index 542ac476177..32987585499 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -78,7 +78,7 @@ fi
 # As Gentoo's strip does not allow us to pass less aggressive stripping
 # options and does not check the machine target we disable stripping
 # entirely.
-RESTRICT=strip
+RESTRICT="strip !test? ( test )"
 
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index fffa190fc85..5e57364b5be 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -80,7 +80,7 @@ fi
 # As Gentoo's strip does not allow us to pass less aggressive stripping
 # options and does not check the machine target we disable stripping
 # entirely.
-RESTRICT=strip
+RESTRICT="strip !test? ( test )"
 
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,

diff --git a/sys-libs/glibc/glibc-2.29-r5.ebuild b/sys-libs/glibc/glibc-2.29-r5.ebuild
index cbcf205430f..5cb7bd73144 100644
--- a/sys-libs/glibc/glibc-2.29-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r5.ebuild
@@ -80,7 +80,7 @@ fi
 # As Gentoo's strip does not allow us to pass less aggressive stripping
 # options and does not check the machine target we disable stripping
 # entirely.
-RESTRICT=strip
+RESTRICT="strip !test? ( test )"
 
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,

diff --git a/sys-libs/glibc/glibc-2.29-r6.ebuild b/sys-libs/glibc/glibc-2.29-r6.ebuild
index 2c67eee47a0..8f88020a9c2 100644
--- a/sys-libs/glibc/glibc-2.29-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r6.ebuild
@@ -107,6 +107,8 @@ RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
 "
 
+RESTRICT="!test? ( test )"
+
 if [[ ${CATEGORY} == cross-* ]] ; then
 	BDEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24

diff --git a/sys-libs/glibc/glibc-2.30-r2.ebuild b/sys-libs/glibc/glibc-2.30-r2.ebuild
index 97a8ffa7165..f3282ba8a07 100644
--- a/sys-libs/glibc/glibc-2.30-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r2.ebuild
@@ -107,6 +107,8 @@ RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
 "
 
+RESTRICT="!test? ( test )"
+
 if [[ ${CATEGORY} == cross-* ]] ; then
 	BDEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 46d8888c699..2298db5a53a 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -108,6 +108,8 @@ RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
 "
 
+RESTRICT="!test? ( test )"
+
 if [[ ${CATEGORY} == cross-* ]] ; then
 	BDEPEND+=" !headers-only? (
 		>=${CATEGORY}/binutils-2.24


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-11-10 22:41 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-11-10 22:41 UTC (permalink / raw
  To: gentoo-commits

commit:     11c2912a7f80e3db37a531671ad6df0655686363
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 10 22:35:21 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Nov 10 22:35:21 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=11c2912a

sys-libs/glibc: drop outdated sys-apps/sandbox

Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild  | 1 -
 sys-libs/glibc/glibc-2.24-r4.ebuild  | 1 -
 sys-libs/glibc/glibc-2.25-r11.ebuild | 1 -
 sys-libs/glibc/glibc-2.26-r7.ebuild  | 1 -
 sys-libs/glibc/glibc-2.27-r6.ebuild  | 1 -
 sys-libs/glibc/glibc-2.28-r6.ebuild  | 1 -
 sys-libs/glibc/glibc-2.29-r2.ebuild  | 1 -
 sys-libs/glibc/glibc-2.29-r5.ebuild  | 1 -
 sys-libs/glibc/glibc-2.29-r6.ebuild  | 1 -
 sys-libs/glibc/glibc-2.30-r2.ebuild  | 1 -
 sys-libs/glibc/glibc-9999.ebuild     | 1 -
 11 files changed, 11 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index 957582bbafe..6c841cd1a40 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -94,7 +94,6 @@ COMMON_DEPEND="
 "
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	doc? ( sys-apps/texinfo )

diff --git a/sys-libs/glibc/glibc-2.24-r4.ebuild b/sys-libs/glibc/glibc-2.24-r4.ebuild
index e3e1776055b..e168c661281 100644
--- a/sys-libs/glibc/glibc-2.24-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.24-r4.ebuild
@@ -94,7 +94,6 @@ COMMON_DEPEND="
 "
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2"
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index 891b8a0d8cf..a005f21e9a4 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -97,7 +97,6 @@ COMMON_DEPEND="
 "
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2"
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions"

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index 85c211433a6..b2b435b823f 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -99,7 +99,6 @@ COMMON_DEPEND="
 "
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2
 	doc? ( sys-apps/texinfo )
 "

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 3f6df9f39e0..5c07a48c554 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -94,7 +94,6 @@ COMMON_DEPEND="
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	doc? ( sys-apps/texinfo )

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index 2e9bf2c5a5d..9768fd77ad2 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -95,7 +95,6 @@ COMMON_DEPEND="
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	!<sys-devel/make-4

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 28632640c0a..291861009eb 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -98,7 +98,6 @@ DEPEND="${COMMON_DEPEND}
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	!<sys-devel/make-4

diff --git a/sys-libs/glibc/glibc-2.29-r5.ebuild b/sys-libs/glibc/glibc-2.29-r5.ebuild
index 1c2a70c547a..1aac53889ea 100644
--- a/sys-libs/glibc/glibc-2.29-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r5.ebuild
@@ -98,7 +98,6 @@ DEPEND="${COMMON_DEPEND}
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	!<sys-devel/make-4

diff --git a/sys-libs/glibc/glibc-2.29-r6.ebuild b/sys-libs/glibc/glibc-2.29-r6.ebuild
index 0f5177fa6c7..0a20a49ef7c 100644
--- a/sys-libs/glibc/glibc-2.29-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r6.ebuild
@@ -87,7 +87,6 @@ BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	!<sys-devel/make-4

diff --git a/sys-libs/glibc/glibc-2.30-r2.ebuild b/sys-libs/glibc/glibc-2.30-r2.ebuild
index 42f0016b4e1..5fb18a44624 100644
--- a/sys-libs/glibc/glibc-2.30-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r2.ebuild
@@ -87,7 +87,6 @@ BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	!<sys-devel/make-4

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 91d75296bc5..31db93055b9 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -88,7 +88,6 @@ BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	!<sys-devel/make-4


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-11-10 22:41 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-11-10 22:41 UTC (permalink / raw
  To: gentoo-commits

commit:     883594bb4bcc024b85c7d124c24b4ed0d6a46a03
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 10 22:32:11 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Nov 10 22:32:11 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=883594bb

sys-libs/glibc: drop outdated sys-libs/nss-db

Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild  | 4 +---
 sys-libs/glibc/glibc-2.24-r4.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.25-r11.ebuild | 3 +--
 sys-libs/glibc/glibc-2.26-r7.ebuild  | 1 -
 sys-libs/glibc/glibc-2.27-r6.ebuild  | 1 -
 sys-libs/glibc/glibc-2.28-r6.ebuild  | 1 -
 sys-libs/glibc/glibc-2.29-r2.ebuild  | 1 -
 sys-libs/glibc/glibc-2.29-r5.ebuild  | 1 -
 sys-libs/glibc/glibc-2.29-r6.ebuild  | 1 -
 sys-libs/glibc/glibc-2.30-r2.ebuild  | 1 -
 sys-libs/glibc/glibc-9999.ebuild     | 1 -
 11 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index de97f115887..da0ba6136c1 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -101,9 +101,7 @@ DEPEND="${COMMON_DEPEND}
 "
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
-"
+	!sys-kernel/ps3-sources"
 
 if [[ ${CATEGORY} == cross-* ]] ; then
 	DEPEND+=" !headers-only? (

diff --git a/sys-libs/glibc/glibc-2.24-r4.ebuild b/sys-libs/glibc/glibc-2.24-r4.ebuild
index 6e4b70cd46d..cd73c2aa9b3 100644
--- a/sys-libs/glibc/glibc-2.24-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.24-r4.ebuild
@@ -99,7 +99,7 @@ DEPEND="${COMMON_DEPEND}
 RDEPEND="${COMMON_DEPEND}
 	!sys-kernel/ps3-sources
 	sys-apps/gentoo-functions
-	!sys-libs/nss-db"
+"
 
 if [[ ${CATEGORY} == cross-* ]] ; then
 	DEPEND+=" !headers-only? (

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index 0f544aa3101..5f5b0cac3c8 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -101,8 +101,7 @@ DEPEND="${COMMON_DEPEND}
 	!<sys-apps/portage-2.1.2"
 RDEPEND="${COMMON_DEPEND}
 	!sys-kernel/ps3-sources
-	sys-apps/gentoo-functions
-	!sys-libs/nss-db"
+	sys-apps/gentoo-functions"
 
 if [[ ${CATEGORY} == cross-* ]] ; then
 	DEPEND+=" !headers-only? (

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index ebe70b6e3ea..62993aadd84 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -106,7 +106,6 @@ DEPEND="${COMMON_DEPEND}
 RDEPEND="${COMMON_DEPEND}
 	!sys-kernel/ps3-sources
 	sys-apps/gentoo-functions
-	!sys-libs/nss-db
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 8815d7bc623..399b44af0b3 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -102,7 +102,6 @@ DEPEND="${COMMON_DEPEND}
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
 	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index 7412d5dfc5c..60c015b1c4e 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -105,7 +105,6 @@ DEPEND="${COMMON_DEPEND}
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
 	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index a09890ee70a..6bbae5725fd 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -108,7 +108,6 @@ DEPEND="${COMMON_DEPEND}
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
 	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then

diff --git a/sys-libs/glibc/glibc-2.29-r5.ebuild b/sys-libs/glibc/glibc-2.29-r5.ebuild
index 5ef228c3688..46869d1feec 100644
--- a/sys-libs/glibc/glibc-2.29-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r5.ebuild
@@ -108,7 +108,6 @@ DEPEND="${COMMON_DEPEND}
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
 	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then

diff --git a/sys-libs/glibc/glibc-2.29-r6.ebuild b/sys-libs/glibc/glibc-2.29-r6.ebuild
index 72a38553096..4c54e772319 100644
--- a/sys-libs/glibc/glibc-2.29-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r6.ebuild
@@ -108,7 +108,6 @@ DEPEND="${COMMON_DEPEND}
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
 	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then

diff --git a/sys-libs/glibc/glibc-2.30-r2.ebuild b/sys-libs/glibc/glibc-2.30-r2.ebuild
index 0958572b1bd..405a2a314a9 100644
--- a/sys-libs/glibc/glibc-2.30-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r2.ebuild
@@ -108,7 +108,6 @@ DEPEND="${COMMON_DEPEND}
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
 	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 4ff0c140c45..e403e6dfe2d 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -109,7 +109,6 @@ DEPEND="${COMMON_DEPEND}
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
 	!sys-kernel/ps3-sources
-	!sys-libs/nss-db
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-11-10 22:41 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-11-10 22:41 UTC (permalink / raw
  To: gentoo-commits

commit:     f815ec7b9f8ba8f526360380f15ea19a438714d1
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 10 22:33:48 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Nov 10 22:33:48 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f815ec7b

sys-libs/glibc: drop outdated sys-kernel/ps3-sources blocker

Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.24-r4.ebuild  | 1 -
 sys-libs/glibc/glibc-2.25-r11.ebuild | 1 -
 sys-libs/glibc/glibc-2.26-r7.ebuild  | 1 -
 sys-libs/glibc/glibc-2.27-r6.ebuild  | 1 -
 sys-libs/glibc/glibc-2.28-r6.ebuild  | 1 -
 sys-libs/glibc/glibc-2.29-r2.ebuild  | 1 -
 sys-libs/glibc/glibc-2.29-r5.ebuild  | 1 -
 sys-libs/glibc/glibc-2.29-r6.ebuild  | 1 -
 sys-libs/glibc/glibc-2.30-r2.ebuild  | 1 -
 sys-libs/glibc/glibc-9999.ebuild     | 1 -
 11 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index da0ba6136c1..957582bbafe 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -101,7 +101,7 @@ DEPEND="${COMMON_DEPEND}
 "
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources"
+"
 
 if [[ ${CATEGORY} == cross-* ]] ; then
 	DEPEND+=" !headers-only? (

diff --git a/sys-libs/glibc/glibc-2.24-r4.ebuild b/sys-libs/glibc/glibc-2.24-r4.ebuild
index cd73c2aa9b3..e3e1776055b 100644
--- a/sys-libs/glibc/glibc-2.24-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.24-r4.ebuild
@@ -97,7 +97,6 @@ DEPEND="${COMMON_DEPEND}
 	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2"
 RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
 	sys-apps/gentoo-functions
 "
 

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index 5f5b0cac3c8..891b8a0d8cf 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -100,7 +100,6 @@ DEPEND="${COMMON_DEPEND}
 	!<sys-apps/sandbox-1.6
 	!<sys-apps/portage-2.1.2"
 RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
 	sys-apps/gentoo-functions"
 
 if [[ ${CATEGORY} == cross-* ]] ; then

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index 62993aadd84..85c211433a6 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -104,7 +104,6 @@ DEPEND="${COMMON_DEPEND}
 	doc? ( sys-apps/texinfo )
 "
 RDEPEND="${COMMON_DEPEND}
-	!sys-kernel/ps3-sources
 	sys-apps/gentoo-functions
 "
 

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 399b44af0b3..3f6df9f39e0 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -101,7 +101,6 @@ DEPEND="${COMMON_DEPEND}
 "
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index 60c015b1c4e..2e9bf2c5a5d 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -104,7 +104,6 @@ DEPEND="${COMMON_DEPEND}
 "
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 6bbae5725fd..28632640c0a 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -107,7 +107,6 @@ DEPEND="${COMMON_DEPEND}
 "
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then

diff --git a/sys-libs/glibc/glibc-2.29-r5.ebuild b/sys-libs/glibc/glibc-2.29-r5.ebuild
index 46869d1feec..1c2a70c547a 100644
--- a/sys-libs/glibc/glibc-2.29-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r5.ebuild
@@ -107,7 +107,6 @@ DEPEND="${COMMON_DEPEND}
 "
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then

diff --git a/sys-libs/glibc/glibc-2.29-r6.ebuild b/sys-libs/glibc/glibc-2.29-r6.ebuild
index 4c54e772319..0f5177fa6c7 100644
--- a/sys-libs/glibc/glibc-2.29-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r6.ebuild
@@ -107,7 +107,6 @@ DEPEND="${COMMON_DEPEND}
 "
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then

diff --git a/sys-libs/glibc/glibc-2.30-r2.ebuild b/sys-libs/glibc/glibc-2.30-r2.ebuild
index 405a2a314a9..42f0016b4e1 100644
--- a/sys-libs/glibc/glibc-2.30-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r2.ebuild
@@ -107,7 +107,6 @@ DEPEND="${COMMON_DEPEND}
 "
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index e403e6dfe2d..91d75296bc5 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -108,7 +108,6 @@ DEPEND="${COMMON_DEPEND}
 "
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
-	!sys-kernel/ps3-sources
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-11-10 22:41 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-11-10 22:41 UTC (permalink / raw
  To: gentoo-commits

commit:     1fad2a01270aed58acab5124b62fe6a50b1f47d5
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 10 22:37:13 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Nov 10 22:37:13 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1fad2a01

sys-libs/glibc: drop outdated sys-apps/portage blocker

Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild  | 1 -
 sys-libs/glibc/glibc-2.24-r4.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.25-r11.ebuild | 2 +-
 sys-libs/glibc/glibc-2.26-r7.ebuild  | 1 -
 sys-libs/glibc/glibc-2.27-r6.ebuild  | 1 -
 sys-libs/glibc/glibc-2.28-r6.ebuild  | 1 -
 sys-libs/glibc/glibc-2.29-r2.ebuild  | 1 -
 sys-libs/glibc/glibc-2.29-r5.ebuild  | 1 -
 sys-libs/glibc/glibc-2.29-r6.ebuild  | 1 -
 sys-libs/glibc/glibc-2.30-r2.ebuild  | 1 -
 sys-libs/glibc/glibc-9999.ebuild     | 1 -
 11 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index 6c841cd1a40..c77d6db5f99 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -94,7 +94,6 @@ COMMON_DEPEND="
 "
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	doc? ( sys-apps/texinfo )
 "

diff --git a/sys-libs/glibc/glibc-2.24-r4.ebuild b/sys-libs/glibc/glibc-2.24-r4.ebuild
index e168c661281..790c6acf66c 100644
--- a/sys-libs/glibc/glibc-2.24-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.24-r4.ebuild
@@ -94,7 +94,7 @@ COMMON_DEPEND="
 "
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/portage-2.1.2"
+"
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
 "

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index a005f21e9a4..14686840b80 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -97,7 +97,7 @@ COMMON_DEPEND="
 "
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/portage-2.1.2"
+"
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions"
 

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index b2b435b823f..bf7478c94f8 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -99,7 +99,6 @@ COMMON_DEPEND="
 "
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
-	!<sys-apps/portage-2.1.2
 	doc? ( sys-apps/texinfo )
 "
 RDEPEND="${COMMON_DEPEND}

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 5c07a48c554..7b629c9b1e8 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -94,7 +94,6 @@ COMMON_DEPEND="
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	doc? ( sys-apps/texinfo )
 "

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index 9768fd77ad2..542ac476177 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -95,7 +95,6 @@ COMMON_DEPEND="
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	!<sys-devel/make-4
 	doc? ( sys-apps/texinfo )

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 291861009eb..fffa190fc85 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -98,7 +98,6 @@ DEPEND="${COMMON_DEPEND}
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	!<sys-devel/make-4
 	doc? ( sys-apps/texinfo )

diff --git a/sys-libs/glibc/glibc-2.29-r5.ebuild b/sys-libs/glibc/glibc-2.29-r5.ebuild
index 1aac53889ea..cbcf205430f 100644
--- a/sys-libs/glibc/glibc-2.29-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r5.ebuild
@@ -98,7 +98,6 @@ DEPEND="${COMMON_DEPEND}
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	!<sys-devel/make-4
 	doc? ( sys-apps/texinfo )

diff --git a/sys-libs/glibc/glibc-2.29-r6.ebuild b/sys-libs/glibc/glibc-2.29-r6.ebuild
index 0a20a49ef7c..2c67eee47a0 100644
--- a/sys-libs/glibc/glibc-2.29-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r6.ebuild
@@ -87,7 +87,6 @@ BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	!<sys-devel/make-4
 	doc? ( sys-apps/texinfo )

diff --git a/sys-libs/glibc/glibc-2.30-r2.ebuild b/sys-libs/glibc/glibc-2.30-r2.ebuild
index 5fb18a44624..97a8ffa7165 100644
--- a/sys-libs/glibc/glibc-2.30-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r2.ebuild
@@ -87,7 +87,6 @@ BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	!<sys-devel/make-4
 	doc? ( sys-apps/texinfo )

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 31db93055b9..46d8888c699 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -88,7 +88,6 @@ BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-apps/portage-2.1.2
 	!<sys-devel/bison-2.7
 	!<sys-devel/make-4
 	doc? ( sys-apps/texinfo )


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-11-16 21:25 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-11-16 21:25 UTC (permalink / raw
  To: gentoo-commits

commit:     e491e9bda4a2bebf873e82c32adebe4fb1d37dda
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 16 21:24:23 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Nov 16 21:25:05 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e491e9bd

sys-libs/glibc: apply 'introduce USE=+crypt' to live ebuild

Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2298db5a53a..9971df60979 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -34,7 +34,7 @@ PATCH_VER=14
 SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps cet compile-locales custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -939,6 +939,7 @@ glibc_do_configure() {
 		--libexecdir='$(libdir)'/misc/glibc
 		--with-bugurl=https://bugs.gentoo.org/
 		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
 		$(use_multiarch || echo --disable-multi-arch)
 		$(use_enable systemtap)
 		$(use_enable nscd)


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-11-16 21:42 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-11-16 21:42 UTC (permalink / raw
  To: gentoo-commits

commit:     8045956db286fac4cf3e6e0a03d5464d7049f889
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 16 21:41:53 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Nov 16 21:41:53 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8045956d

sys-libs/glibc: expose errors in sync primitives checks

In bug #700232 CFLAGS_x86 mis-detects unsupported sync
primitives. That triggers accidental -march=* filter-out.

This change should expose actual built failure.

Bug: https://bugs.gentoo.org/700232
Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r2.ebuild | 6 +++---
 sys-libs/glibc/glibc-9999.ebuild    | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30-r2.ebuild b/sys-libs/glibc/glibc-2.30-r2.ebuild
index f3282ba8a07..910396913f2 100644
--- a/sys-libs/glibc/glibc-2.30-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r2.ebuild
@@ -198,7 +198,7 @@ do_compile_test() {
 	rm -f glibc-test*
 	printf '%b' "$*" > glibc-test.c
 
-	nonfatal emake -s glibc-test
+	nonfatal emake glibc-test
 	ret=$?
 
 	popd >/dev/null
@@ -246,7 +246,7 @@ setup_target_flags() {
 			# We could change main to _start and pass -nostdlib here so that we
 			# only test the gcc code compilation.  Or we could do a compile and
 			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
+			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
 				local t=${CTARGET_OPT:-${CTARGET}}
 				t=${t%%-*}
 				filter-flags '-march=*'
@@ -259,7 +259,7 @@ setup_target_flags() {
 			# Note: This test only matters when the x86 ABI is enabled, so we could
 			# optimize a bit and elide it.
 			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 9971df60979..f1b57d70806 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -199,7 +199,7 @@ do_compile_test() {
 	rm -f glibc-test*
 	printf '%b' "$*" > glibc-test.c
 
-	nonfatal emake -s glibc-test
+	nonfatal emake glibc-test
 	ret=$?
 
 	popd >/dev/null
@@ -247,7 +247,7 @@ setup_target_flags() {
 			# We could change main to _start and pass -nostdlib here so that we
 			# only test the gcc code compilation.  Or we could do a compile and
 			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
+			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
 				local t=${CTARGET_OPT:-${CTARGET}}
 				t=${t%%-*}
 				filter-flags '-march=*'
@@ -260,7 +260,7 @@ setup_target_flags() {
 			# Note: This test only matters when the x86 ABI is enabled, so we could
 			# optimize a bit and elide it.
 			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-11-17 10:42 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-11-17 10:42 UTC (permalink / raw
  To: gentoo-commits

commit:     525bc6c0fef5bc316812df10a93dceafdfe25e16
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 17 10:41:08 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Nov 17 10:42:00 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=525bc6c0

sys-libs/glibc: mangle bad -march= only for ABI=x86

Normally setup_target_flags() attempts to guard against
too conservative (or missing) -march= value by chacking
if sync primitives can be compiled. If it can't be compiled
glibc assumes -march= value to be too low.

Unfortunately, test always runs against 32-bit ABI without
checking if current ABI is actually 32-bit. This causes
the test mis-fire on USE=-multilib ARCH=amd64 systems.

Sweep workaround under ABI=x86 case.

Reported-by: Klaus Kusche
Closes: https://bugs.gentoo.org/700232
Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r2.ebuild | 5 ++---
 sys-libs/glibc/glibc-9999.ebuild    | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30-r2.ebuild b/sys-libs/glibc/glibc-2.30-r2.ebuild
index 910396913f2..21a2145abdd 100644
--- a/sys-libs/glibc/glibc-2.30-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r2.ebuild
@@ -256,9 +256,8 @@ setup_target_flags() {
 		;;
 		amd64)
 			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
 			# 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%%-*}
@@ -269,7 +268,7 @@ setup_target_flags() {
 				# 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"
+				einfo "Auto adding -march=${t} to CFLAGS_x86 #185404 (ABI=${ABI})"
 			fi
 		;;
 		mips)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f1b57d70806..4ddf0a27321 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -257,9 +257,8 @@ setup_target_flags() {
 		;;
 		amd64)
 			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
 			# 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%%-*}
@@ -270,7 +269,7 @@ setup_target_flags() {
 				# 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"
+				einfo "Auto adding -march=${t} to CFLAGS_x86 #185404 (ABI=${ABI})"
 			fi
 		;;
 		mips)


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-11-21  7:54 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-11-21  7:54 UTC (permalink / raw
  To: gentoo-commits

commit:     1968d85e42382fa4820f6978e116abe091ac4825
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 21 07:53:41 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Nov 21 07:53:56 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1968d85e

sys-libs/glibc: drop -c (--force) flag from localedef

As found out in https://sourceware.org/PR25195
-c/--force makes 'localedef' to ignore all errors.

The change drops -c flag and relies on clean run.

Reported-by: Chris Slycord
Bug: https://bugs.gentoo.org/697908
Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index cb91c2cf08a..a379b461b06 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,4 +18,4 @@ DIST glibc-2.29-patches-7.tar.xz 64752 BLAKE2B 766f3f2d11aedf7e1b83db94fd2793244
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-3.tar.xz 20412 BLAKE2B 8cd588284bf07985262a0289d8cbae03b0a75c48110fed6152c0431dc4f729a9695df910b1521a6072e9736b26145bf372d5b60163f64f4556f17f2f9f223e11 SHA512 0da9107518117a1cf901d282f2b84a2f4780130ab9eb7025ffd8b7e629aa6fd5f05b293dd49fc3c300bc2e74e7f81fc1f8a7cb12428b2be086a160d429715758
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
-DIST glibc-9999-patches-14.tar.xz 17908 BLAKE2B a6e1f22a4358111ff757431c5d42fd020f6095584c3517aa854ea266129d1a177a7c09b310643f1cea32ffaf253806ac08f3aed864fb477097aaa2c4010450f4 SHA512 ef28b409b26472ec1d868167345aecfee70b1edf1863374dc2f25892f40c10f0826620a8b22fbbc9f737c8f611569b3412e8e2ea041da1ad1ef7f6398b82cddc
+DIST glibc-9999-patches-15.tar.xz 17792 BLAKE2B fe351b7c71418a4707c96fbc6832f831947515bb2ce01fcfa9a9ea410f543a50b8c013e26f10587b283acbab4e988272e8db770112b2961b11c89b20b4a408f7 SHA512 37db45d1d04ad1130319a58d04774a2ada0f026bacd444625782b4dcf5a98a7019a17e132dd1e497968f43fde2c974bbe09a41e164831769a9e95bc8e2117103

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 4ddf0a27321..f5b0f72d19b 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -29,7 +29,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=14
+PATCH_VER=15
 
 SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-11-25  1:37 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-11-25  1:37 UTC (permalink / raw
  To: gentoo-commits

commit:     e17f86989bb169e3892a3181ca3fb660bcf4c8c9
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 25 01:36:44 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Nov 25 01:37:01 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e17f8698

sys-libs/glibc: New 2.29 patchset / revbump

Some tests fail, needs still review; no keywords thus.

FAIL: elf/tst-latepthread
FAIL: elf/tst-pldd
XPASS: elf/tst-protected1a
XPASS: elf/tst-protected1b
UNSUPPORTED: misc/tst-pkey
UNSUPPORTED: nptl/test-cond-printers
UNSUPPORTED: nptl/test-condattr-printers
UNSUPPORTED: nptl/test-mutex-printers
UNSUPPORTED: nptl/test-mutexattr-printers
UNSUPPORTED: nptl/test-rwlock-printers
UNSUPPORTED: nptl/test-rwlockattr-printers
FAIL: nss/tst-nss-db-endgrent
FAIL: nss/tst-nss-db-endpwent
FAIL: nss/tst-nss-test3
FAIL: resolv/tst-resolv-ai_idn
FAIL: resolv/tst-resolv-ai_idn-latin1
UNSUPPORTED: time/tst-y2039
Summary of test results:
      7 FAIL
   5871 PASS
      8 UNSUPPORTED
     17 XFAIL
      2 XPASS

Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.29-r7.ebuild | 1478 +++++++++++++++++++++++++++++++++++
 2 files changed, 1479 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index a379b461b06..e0d39549cae 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,6 +15,7 @@ DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79
 DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525eccfec462d638dbc25c581e5b7a2a72ffd5191842f5ac443a868cbc950838d7e5120e866d343a14b80c55dcbfa48f30 SHA512 4c9b78d9d1a8aa629418f2d758ef800857780b8a1fd8d3582b88348a513ca26ca7f6ac9110a8c6bae16949b360ba36840d184f42293cd4324760273592d1b438
 DIST glibc-2.29-patches-6.tar.xz 64076 BLAKE2B 04c1baf838eff9275e79145d4a5a642dcd6572aadcdfc6782769f2de107dcd1648b81d0690068db8c0d53229efe2130e279f4aafe8a91238e5dd6a8a7120a433 SHA512 6494dcd23441fe308de97706f7abbea1571e0015d1456e719268b8026e1fb23733c2efd5256840f4b9f0df4f02ac7827b1fad56905cbd8919bca9c25b0afe822
 DIST glibc-2.29-patches-7.tar.xz 64752 BLAKE2B 766f3f2d11aedf7e1b83db94fd2793244e29abc0beb78071a3eadfb83d3589f56b07b68c8faffd77ecc859497ba52f0327e03cf984b00adbeee3e196b0c5e57c SHA512 aea61fd3e084b293d0a92c89cd83d176ca95112e23224091e31ac77f54089922926ebbd9b75748d5b750f3d88c6f55f9953f11375a07a219946c485d4bf6bcaf
+DIST glibc-2.29-patches-8.tar.xz 102712 BLAKE2B 49aacff358c0f8499c444e73eec92f402b81236d6a91d1fc9864f974c5cb72fc5c87bf5ee77700a8333db4c68892b3940948158530cea0d0fbbda51df0ae7953 SHA512 7a929e023294e6b76569120cc234bc862f3e260994e56c3a2fc2b969b7313c94a47de7ef85f4e93c9083c16fde987ca470ab9d69d881ab49a22f5fd3a721703a
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-3.tar.xz 20412 BLAKE2B 8cd588284bf07985262a0289d8cbae03b0a75c48110fed6152c0431dc4f729a9695df910b1521a6072e9736b26145bf372d5b60163f64f4556f17f2f9f223e11 SHA512 0da9107518117a1cf901d282f2b84a2f4780130ab9eb7025ffd8b7e629aa6fd5f05b293dd49fc3c300bc2e74e7f81fc1f8a7cb12428b2be086a160d429715758
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
new file mode 100644
index 00000000000..fad4d17a464
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild
@@ -0,0 +1,1478 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{5,6,7} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+#	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=8
+PATCH_DEV=dilfridge
+
+SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.0.5
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake -s glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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' 2>/dev/null ; then
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		amd64)
+			# -march needed for #185404 #199334
+			# Note: This test only matters when the x86 ABI is enabled, so we could
+			# optimize a bit and elide it.
+			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparc64v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparcv9v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Over-zealous CFLAGS can often cause problems.  What may work for one
+	# person may not work for another.  To avoid a large influx of bugs
+	# relating to failed builds, we strip most CFLAGS out to ensure as few
+	# problems as possible.
+	strip-flags
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# Lock glibc at -O2; we want to be conservative here.
+	# -fno-strict-aliasing is to work around #155906.
+	filter-flags '-O?'
+	append-flags -O2 -fno-strict-aliasing
+
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ -n ${ROOT} ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=$(usex ssp all no) )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-11-25 23:49 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-11-25 23:49 UTC (permalink / raw
  To: gentoo-commits

commit:     5872a5e9c462da5702a0a5d0f6803050b46e7c6d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 25 23:49:11 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Nov 25 23:49:53 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5872a5e9

sys-libs/glibc: 2.30 revision bump, new patchset, no keywords

Test failures are precisely the same as in -r2

FAIL: elf/ifuncmain9picstatic
FAIL: elf/ifuncmain9static
FAIL: elf/tst-latepthread
FAIL: elf/tst-ldconfig-bad-aux-cache
FAIL: elf/tst-pldd
XPASS: elf/tst-protected1a
XPASS: elf/tst-protected1b
FAIL: locale/tst-locale-locpath
FAIL: malloc/tst-mallocfork2
UNSUPPORTED: misc/tst-pkey
UNSUPPORTED: nptl/test-cond-printers
UNSUPPORTED: nptl/test-condattr-printers
UNSUPPORTED: nptl/test-mutex-printers
UNSUPPORTED: nptl/test-mutexattr-printers
UNSUPPORTED: nptl/test-rwlock-printers
UNSUPPORTED: nptl/test-rwlockattr-printers
FAIL: nss/tst-nss-db-endgrent
FAIL: nss/tst-nss-db-endpwent
FAIL: nss/tst-nss-files-alias-leak
FAIL: nss/tst-nss-files-alias-truncated
FAIL: nss/tst-nss-files-hosts-long
FAIL: nss/tst-nss-test3
FAIL: resolv/tst-resolv-ai_idn
FAIL: resolv/tst-resolv-ai_idn-latin1
UNSUPPORTED: time/tst-y2039
Summary of test results:
     15 FAIL
   5969 PASS
      8 UNSUPPORTED
     17 XFAIL
      2 XPASS

Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.30-r3.ebuild | 1489 +++++++++++++++++++++++++++++++++++
 2 files changed, 1490 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index e0d39549cae..96f7cce5fb3 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,5 +18,6 @@ DIST glibc-2.29-patches-7.tar.xz 64752 BLAKE2B 766f3f2d11aedf7e1b83db94fd2793244
 DIST glibc-2.29-patches-8.tar.xz 102712 BLAKE2B 49aacff358c0f8499c444e73eec92f402b81236d6a91d1fc9864f974c5cb72fc5c87bf5ee77700a8333db4c68892b3940948158530cea0d0fbbda51df0ae7953 SHA512 7a929e023294e6b76569120cc234bc862f3e260994e56c3a2fc2b969b7313c94a47de7ef85f4e93c9083c16fde987ca470ab9d69d881ab49a22f5fd3a721703a
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-3.tar.xz 20412 BLAKE2B 8cd588284bf07985262a0289d8cbae03b0a75c48110fed6152c0431dc4f729a9695df910b1521a6072e9736b26145bf372d5b60163f64f4556f17f2f9f223e11 SHA512 0da9107518117a1cf901d282f2b84a2f4780130ab9eb7025ffd8b7e629aa6fd5f05b293dd49fc3c300bc2e74e7f81fc1f8a7cb12428b2be086a160d429715758
+DIST glibc-2.30-patches-4.tar.xz 32428 BLAKE2B 7bdcf6f64b22d19b1ef79f466ed0c6e7a289900fbde46eec2a0f4c5458f2088928c1c3f7534eb9794659598d39d2bca21e0922d0cd0f8a459e744abe9197807c SHA512 a80c3a304bcb1acf3a71e5f55782c8aed09747139d6f554bd81b66cef77fcdf33fb943a30cc29e0b9f34cc3d005b08f11f74365b3f9ab32754ce63cbc530ad46
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-9999-patches-15.tar.xz 17792 BLAKE2B fe351b7c71418a4707c96fbc6832f831947515bb2ce01fcfa9a9ea410f543a50b8c013e26f10587b283acbab4e988272e8db770112b2961b11c89b20b4a408f7 SHA512 37db45d1d04ad1130319a58d04774a2ada0f026bacd444625782b4dcf5a98a7019a17e132dd1e497968f43fde2c974bbe09a41e164831769a9e95bc8e2117103

diff --git a/sys-libs/glibc/glibc-2.30-r3.ebuild b/sys-libs/glibc/glibc-2.30-r3.ebuild
new file mode 100644
index 00000000000..146a4563929
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.30-r3.ebuild
@@ -0,0 +1,1489 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{5,6,7} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+#	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=4
+PATCH_DEV=dilfridge
+
+SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.0.5
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparc64v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparcv9v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ -n ${ROOT} ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=$(usex ssp all no) )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-11-26 23:22 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-11-26 23:22 UTC (permalink / raw
  To: gentoo-commits

commit:     c5e4a439962f12acf7b223be108ad613dff61a69
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 26 23:21:56 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Nov 26 23:22:24 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c5e4a439

sys-libs/glibc: Restore keywords of 2.30-r3

Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.30-r3.ebuild b/sys-libs/glibc/glibc-2.30-r3.ebuild
index 146a4563929..2178d1b5865 100644
--- a/sys-libs/glibc/glibc-2.30-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r3.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-#	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-11-26 23:45 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-11-26 23:45 UTC (permalink / raw
  To: gentoo-commits

commit:     b8591daa17425d455e91a935db72839a6c27455f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 26 23:45:07 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Nov 26 23:45:07 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b8591daa

sys-libs/glibc: Restore keywords of 2.29-r7

Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
index fad4d17a464..321352d79f9 100644
--- a/sys-libs/glibc/glibc-2.29-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-#	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-11-27 22:51 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2019-11-27 22:51 UTC (permalink / raw
  To: gentoo-commits

commit:     bcf02d0a8562bb7dbd0839eecd1f0748fc40ea39
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 27 22:50:46 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Nov 27 22:50:59 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bcf02d0a

sys-libs/glibc: Remove old revs

Package-Manager: Portage-2.3.80, Repoman-2.3.19
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 -
 sys-libs/glibc/glibc-2.29-r5.ebuild | 1472 ----------------------------------
 sys-libs/glibc/glibc-2.29-r6.ebuild | 1477 -----------------------------------
 3 files changed, 2951 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 96f7cce5fb3..304a7131733 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -13,8 +13,6 @@ DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea
 DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 4ab583be712994f949dee2512da6e12fd7f7ad73e96393f21678552b43da98f49321b53b5b009551300cdb09ca135e7f6adc636ff750c251a1d6d7f262dbc410 SHA512 e3f40ae6e9d06471c1a11bd2bce7b5161d07c3d0a81791505a72aec4817e7faf9ef09841e98c6dcf62a0a00754dff87dd194d97ac6b6354aeb2497cf60900b96
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525eccfec462d638dbc25c581e5b7a2a72ffd5191842f5ac443a868cbc950838d7e5120e866d343a14b80c55dcbfa48f30 SHA512 4c9b78d9d1a8aa629418f2d758ef800857780b8a1fd8d3582b88348a513ca26ca7f6ac9110a8c6bae16949b360ba36840d184f42293cd4324760273592d1b438
-DIST glibc-2.29-patches-6.tar.xz 64076 BLAKE2B 04c1baf838eff9275e79145d4a5a642dcd6572aadcdfc6782769f2de107dcd1648b81d0690068db8c0d53229efe2130e279f4aafe8a91238e5dd6a8a7120a433 SHA512 6494dcd23441fe308de97706f7abbea1571e0015d1456e719268b8026e1fb23733c2efd5256840f4b9f0df4f02ac7827b1fad56905cbd8919bca9c25b0afe822
-DIST glibc-2.29-patches-7.tar.xz 64752 BLAKE2B 766f3f2d11aedf7e1b83db94fd2793244e29abc0beb78071a3eadfb83d3589f56b07b68c8faffd77ecc859497ba52f0327e03cf984b00adbeee3e196b0c5e57c SHA512 aea61fd3e084b293d0a92c89cd83d176ca95112e23224091e31ac77f54089922926ebbd9b75748d5b750f3d88c6f55f9953f11375a07a219946c485d4bf6bcaf
 DIST glibc-2.29-patches-8.tar.xz 102712 BLAKE2B 49aacff358c0f8499c444e73eec92f402b81236d6a91d1fc9864f974c5cb72fc5c87bf5ee77700a8333db4c68892b3940948158530cea0d0fbbda51df0ae7953 SHA512 7a929e023294e6b76569120cc234bc862f3e260994e56c3a2fc2b969b7313c94a47de7ef85f4e93c9083c16fde987ca470ab9d69d881ab49a22f5fd3a721703a
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-3.tar.xz 20412 BLAKE2B 8cd588284bf07985262a0289d8cbae03b0a75c48110fed6152c0431dc4f729a9695df910b1521a6072e9736b26145bf372d5b60163f64f4556f17f2f9f223e11 SHA512 0da9107518117a1cf901d282f2b84a2f4780130ab9eb7025ffd8b7e629aa6fd5f05b293dd49fc3c300bc2e74e7f81fc1f8a7cb12428b2be086a160d429715758

diff --git a/sys-libs/glibc/glibc-2.29-r5.ebuild b/sys-libs/glibc/glibc-2.29-r5.ebuild
deleted file mode 100644
index 5cb7bd73144..00000000000
--- a/sys-libs/glibc/glibc-2.29-r5.ebuild
+++ /dev/null
@@ -1,1472 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-PYTHON_COMPAT=( python3_{5,6,7} )
-
-inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=6
-
-SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we disable stripping
-# entirely.
-RESTRICT="strip !test? ( test )"
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-		virtual/os-headers
-	"
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all no) )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	local locale_list="${root}/etc/locale.gen"
-
-	pushd "${ED}"/$(get_libdir)
-
-	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"
-	fi
-
-	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-
-	popd
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install || die
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.29-r6.ebuild b/sys-libs/glibc/glibc-2.29-r6.ebuild
deleted file mode 100644
index 8f88020a9c2..00000000000
--- a/sys-libs/glibc/glibc-2.29-r6.ebuild
+++ /dev/null
@@ -1,1477 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{5,6,7} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=7
-
-SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ -n ${ROOT} ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all no) )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-12-02 23:17 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-12-02 23:17 UTC (permalink / raw
  To: gentoo-commits

commit:     ef41b3fceed81b2346bc2d83c1402d2cded5ab1d
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon Dec  2 23:16:52 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon Dec  2 23:16:52 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ef41b3fc

sys-libs/glibc: add explicit 'gd' dependency

Closes: https://bugs.gentoo.org/701726
Package-Manager: Portage-2.3.80, Repoman-2.3.19
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r3.ebuild | 1 +
 sys-libs/glibc/glibc-9999.ebuild    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.30-r3.ebuild b/sys-libs/glibc/glibc-2.30-r3.ebuild
index 2178d1b5865..4bfd7773993 100644
--- a/sys-libs/glibc/glibc-2.30-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r3.ebuild
@@ -93,6 +93,7 @@ BDEPEND="
 	doc? ( sys-apps/texinfo )
 "
 COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
 	nscd? ( selinux? (
 		audit? ( sys-process/audit )
 		caps? ( sys-libs/libcap )

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f5b0f72d19b..22b51c311c6 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -93,6 +93,7 @@ BDEPEND="
 	doc? ( sys-apps/texinfo )
 "
 COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
 	nscd? ( selinux? (
 		audit? ( sys-process/audit )
 		caps? ( sys-libs/libcap )


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-12-10 15:52 Mike Gilbert
  0 siblings, 0 replies; 1076+ messages in thread
From: Mike Gilbert @ 2019-12-10 15:52 UTC (permalink / raw
  To: gentoo-commits

commit:     dff49688524f9d2b59cd8d0ef3a9efd79afd834d
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 10 15:47:15 2019 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Tue Dec 10 15:52:08 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dff49688

sys-libs/glibc: drop usr-ldscript

This was a false-positive when greping for gen_usr_ldscript.

Fixes: 713eee8ef99085e417f4e2f4ba7d8dad9ba8c90d
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild | 2 +-
 sys-libs/glibc/glibc-2.26-r7.ebuild | 2 +-
 sys-libs/glibc/glibc-2.27-r6.ebuild | 2 +-
 sys-libs/glibc/glibc-2.28-r6.ebuild | 2 +-
 sys-libs/glibc/glibc-2.29-r2.ebuild | 2 +-
 sys-libs/glibc/glibc-2.29-r7.ebuild | 2 +-
 sys-libs/glibc/glibc-2.30-r2.ebuild | 2 +-
 sys-libs/glibc/glibc-2.30-r3.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index c77d6db5f99..ee7e7179697 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=6
 
-inherit prefix eutils toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
+inherit prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index bf7478c94f8..ae725c40c7c 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=6
 
-inherit prefix toolchain-glibc usr-ldscript
+inherit prefix toolchain-glibc
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 7b629c9b1e8..1e6d8113f9f 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=6
 
-inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
+inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index 32987585499..797405fefda 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=6
 
-inherit prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
+inherit prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index 5e57364b5be..af2826f3bce 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -5,7 +5,7 @@ EAPI=6
 
 PYTHON_COMPAT=( python3_{5,6,7} )
 
-inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
+inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
index 321352d79f9..d0bcabac62d 100644
--- a/sys-libs/glibc/glibc-2.29-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild
@@ -5,7 +5,7 @@ EAPI=7
 
 PYTHON_COMPAT=( python3_{5,6,7} )
 
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"

diff --git a/sys-libs/glibc/glibc-2.30-r2.ebuild b/sys-libs/glibc/glibc-2.30-r2.ebuild
index 21a2145abdd..8e5b658c2eb 100644
--- a/sys-libs/glibc/glibc-2.30-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r2.ebuild
@@ -5,7 +5,7 @@ EAPI=7
 
 PYTHON_COMPAT=( python3_{5,6,7} )
 
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"

diff --git a/sys-libs/glibc/glibc-2.30-r3.ebuild b/sys-libs/glibc/glibc-2.30-r3.ebuild
index 4bfd7773993..7bbdf0c882a 100644
--- a/sys-libs/glibc/glibc-2.30-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r3.ebuild
@@ -5,7 +5,7 @@ EAPI=7
 
 PYTHON_COMPAT=( python3_{5,6,7} )
 
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 22b51c311c6..a3d9d33a368 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -5,7 +5,7 @@ EAPI=7
 
 PYTHON_COMPAT=( python3_{5,6,7} )
 
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-12-10 19:03 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2019-12-10 19:03 UTC (permalink / raw
  To: gentoo-commits

commit:     a8414176db8eecd54b46ba55d5b3dbeef9ef0eba
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 10 19:03:34 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Tue Dec 10 19:03:34 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8414176

sys-libs/glibc: amd64 stable wrt bug #702484

Package-Manager: Portage-2.3.79, Repoman-2.3.16
RepoMan-Options: --include-arches="amd64"
Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
index d0bcabac62d..2e97ec96098 100644
--- a/sys-libs/glibc/glibc-2.29-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-12-11 13:21 Aaron Bauman
  0 siblings, 0 replies; 1076+ messages in thread
From: Aaron Bauman @ 2019-12-11 13:21 UTC (permalink / raw
  To: gentoo-commits

commit:     a0efe816684f53adaf08de0596a2ca389a1410ca
Author:     Aaron Bauman <bman <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 11 13:20:59 2019 +0000
Commit:     Aaron Bauman <bman <AT> gentoo <DOT> org>
CommitDate: Wed Dec 11 13:20:59 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a0efe816

sys-libs/glibc: arm64 stable (bug #702484)

Signed-off-by: Aaron Bauman <bman <AT> gentoo.org>
Package-Manager: Portage-2.3.81, Repoman-2.3.20

 sys-libs/glibc/glibc-2.29-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
index 2e97ec96098..7379a12118c 100644
--- a/sys-libs/glibc/glibc-2.29-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-12-12 10:59 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2019-12-12 10:59 UTC (permalink / raw
  To: gentoo-commits

commit:     82ab4b05993897ad3db386df3375ea260bacc6c0
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 12 10:59:32 2019 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Thu Dec 12 10:59:32 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=82ab4b05

sys-libs/glibc: x86 stable wrt bug #702484

Package-Manager: Portage-2.3.79, Repoman-2.3.16
RepoMan-Options: --include-arches="x86"
Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
index 7379a12118c..b253628cb0e 100644
--- a/sys-libs/glibc/glibc-2.29-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-12-12 13:52 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2019-12-12 13:52 UTC (permalink / raw
  To: gentoo-commits

commit:     ffd9b1c0cbcb450b93e9f22c5a763fb52b86b917
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 12 13:52:42 2019 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Thu Dec 12 13:52:42 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ffd9b1c0

sys-libs/glibc: ppc64 stable wrt bug #702484

Package-Manager: Portage-2.3.79, Repoman-2.3.16
RepoMan-Options: --include-arches="ppc64"
Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
index b253628cb0e..9053a141d36 100644
--- a/sys-libs/glibc/glibc-2.29-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-12-12 16:00 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2019-12-12 16:00 UTC (permalink / raw
  To: gentoo-commits

commit:     090ef611eb6d9b5808850b372c17ed1c4a6e9dd5
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 12 16:00:55 2019 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Thu Dec 12 16:00:55 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=090ef611

sys-libs/glibc: ppc stable wrt bug #702484

Package-Manager: Portage-2.3.79, Repoman-2.3.16
RepoMan-Options: --include-arches="ppc"
Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
index 9053a141d36..eff0018c92b 100644
--- a/sys-libs/glibc/glibc-2.29-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sh ~sparc x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-12-12 21:52 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-12-12 21:52 UTC (permalink / raw
  To: gentoo-commits

commit:     44cd0fbce101571eeb4aba1b564593b7a5678ab4
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 12 21:49:33 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Dec 12 21:52:11 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=44cd0fbc

sys-libs/glibc: stable 2.29-r7 for ia64, bug #702484

Package-Manager: Portage-2.3.81, Repoman-2.3.20
RepoMan-Options: --include-arches="ia64"
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
index eff0018c92b..fa7fd906216 100644
--- a/sys-libs/glibc/glibc-2.29-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sh ~sparc x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-12-13  7:36 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2019-12-13  7:36 UTC (permalink / raw
  To: gentoo-commits

commit:     322cd209fab381b82b4b45f69579e5e3e8b7c414
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 13 07:36:52 2019 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Fri Dec 13 07:36:52 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=322cd209

sys-libs/glibc: s390 stable wrt bug #702484

Package-Manager: Portage-2.3.79, Repoman-2.3.16
RepoMan-Options: --include-arches="s390"
Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
index fa7fd906216..aba9eb78e9d 100644
--- a/sys-libs/glibc/glibc-2.29-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sh ~sparc x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~riscv s390 ~sh ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-12-15 10:59 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2019-12-15 10:59 UTC (permalink / raw
  To: gentoo-commits

commit:     1d0c1362344af6ab1f45583f49855f3f24260721
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 15 10:58:48 2019 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Sun Dec 15 10:58:48 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1d0c1362

sys-libs/glibc: sparc stable wrt bug #702484

Package-Manager: Portage-2.3.79, Repoman-2.3.16
RepoMan-Options: --include-arches="sparc"
Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
index aba9eb78e9d..c7a3255931a 100644
--- a/sys-libs/glibc/glibc-2.29-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~riscv s390 ~sh ~sparc x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~riscv s390 ~sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-12-24 13:58 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2019-12-24 13:58 UTC (permalink / raw
  To: gentoo-commits

commit:     97537ded324844a2345ab322a2a6f0af06e8b974
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 24 13:57:49 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Tue Dec 24 13:57:49 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=97537ded

sys-libs/glibc: arm stable wrt bug #702484

Package-Manager: Portage-2.3.79, Repoman-2.3.16
RepoMan-Options: --include-arches="arm"
Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
index c7a3255931a..c1f92bc1c96 100644
--- a/sys-libs/glibc/glibc-2.29-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~riscv s390 ~sh sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~riscv s390 ~sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-12-25 10:58 Benda XU
  0 siblings, 0 replies; 1076+ messages in thread
From: Benda XU @ 2019-12-25 10:58 UTC (permalink / raw
  To: gentoo-commits

commit:     7c1ace82e82ecebd13ac180bb0d1e6d82258e99b
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 25 09:28:55 2019 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Wed Dec 25 10:57:58 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c1ace82

sys-libs/glibc: cross-*: pass EPREFIX to --with-headers

  This is a follow up of ea4cbdc9159c0ebbd29d4062bbb314393a8cc32f.

  Otherwise when building cross toolchain on Gentoo Prefix, configure cannot
  find the needed linux-headers.

Bug: https://bugs.gentoo.org/642604
Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r3.ebuild | 4 ++--
 sys-libs/glibc/glibc-9999.ebuild    | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30-r3.ebuild b/sys-libs/glibc/glibc-2.30-r3.ebuild
index 7bbdf0c882a..393684b8a8b 100644
--- a/sys-libs/glibc/glibc-2.30-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r3.ebuild
@@ -929,7 +929,7 @@ glibc_do_configure() {
 		--host=${CTARGET_OPT:-${CTARGET}}
 		$(use_enable profile)
 		$(use_with gd)
-		--with-headers=$(alt_build_headers)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
 		--prefix="$(host_eprefix)/usr"
 		--sysconfdir="$(host_eprefix)/etc"
 		--localstatedir="$(host_eprefix)/var"
@@ -1084,7 +1084,7 @@ glibc_headers_configure() {
 		--enable-bind-now
 		--build=${CBUILD_OPT:-${CBUILD}}
 		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
 		--prefix="$(host_eprefix)/usr"
 		${EXTRA_ECONF}
 	)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a3d9d33a368..94ff23bb27e 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -929,7 +929,7 @@ glibc_do_configure() {
 		--host=${CTARGET_OPT:-${CTARGET}}
 		$(use_enable profile)
 		$(use_with gd)
-		--with-headers=$(alt_build_headers)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
 		--prefix="$(host_eprefix)/usr"
 		--sysconfdir="$(host_eprefix)/etc"
 		--localstatedir="$(host_eprefix)/var"
@@ -1084,7 +1084,7 @@ glibc_headers_configure() {
 		--enable-bind-now
 		--build=${CBUILD_OPT:-${CBUILD}}
 		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
 		--prefix="$(host_eprefix)/usr"
 		${EXTRA_ECONF}
 	)


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2019-12-28 13:49 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2019-12-28 13:49 UTC (permalink / raw
  To: gentoo-commits

commit:     00b0d392e3dc646f778ea8507ade05b7a2d26891
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 28 12:48:52 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Dec 28 13:49:36 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=00b0d392

sys-libs/glibc: allow python-3.8

Reported-by: Perfect Gentleman
Closes: https://bugs.gentoo.org/702964
Package-Manager: Portage-2.3.84, Repoman-2.3.20
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r3.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30-r3.ebuild b/sys-libs/glibc/glibc-2.30-r3.ebuild
index 393684b8a8b..5dcff2ff710 100644
--- a/sys-libs/glibc/glibc-2.30-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r3.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{5,6,7} )
+PYTHON_COMPAT=( python3_{5,6,7,8} )
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 94ff23bb27e..a58635e9fc4 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{5,6,7} )
+PYTHON_COMPAT=( python3_{5,6,7,8} )
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-01-12 22:36 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-01-12 22:36 UTC (permalink / raw
  To: gentoo-commits

commit:     6c91c3bb46ed1f02df368c07538f7fd28a1c24f2
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 12 22:36:17 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jan 12 22:36:51 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6c91c3bb

sys-libs/glibc: stable 2.29-r7 for hppa, bug #702484

Package-Manager: Portage-2.3.84, Repoman-2.3.20
RepoMan-Options: --include-arches="hppa"
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
index 4efa3354fba..18e81921055 100644
--- a/sys-libs/glibc/glibc-2.29-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~riscv s390 ~sh sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~riscv s390 ~sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-02-02 13:04 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-02-02 13:04 UTC (permalink / raw
  To: gentoo-commits

commit:     041093897e70b36a54d1cdb11d626c00b67f1e88
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Feb  2 13:01:02 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Feb  2 13:04:45 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04109389

sys-libs/glibc: drop 'telinit U' call

Bug: https://bugs.gentoo.org/642784
Package-Manager: Portage-2.3.87, Repoman-2.3.20
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild | 6 +-----
 sys-libs/glibc/glibc-2.26-r7.ebuild | 6 +-----
 sys-libs/glibc/glibc-2.27-r6.ebuild | 6 +-----
 sys-libs/glibc/glibc-2.28-r6.ebuild | 6 +-----
 sys-libs/glibc/glibc-2.29-r2.ebuild | 4 ----
 5 files changed, 4 insertions(+), 24 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index b30a924271c..e8877a90634 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -1290,10 +1290,6 @@ pkg_postinst() {
 	fi
 
 	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
 		use compile-locales || run_locale_gen "${EROOT}"
 	fi
 

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index 049428f9e18..b859afdc2fa 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -831,10 +831,6 @@ pkg_postinst() {
 	fi
 
 	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
 		# if the host locales.gen contains no entries, we'll install everything
 		local locale_list="${EROOT}etc/locale.gen"
 		if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
index 7cb9a7bb250..bc34884497c 100644
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r6.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -1395,10 +1395,6 @@ pkg_postinst() {
 	fi
 
 	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
 		use compile-locales || run_locale_gen "${EROOT}"
 	fi
 

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index ec171e22018..d39698a15a8 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -1393,10 +1393,6 @@ pkg_postinst() {
 	fi
 
 	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
 		use compile-locales || run_locale_gen "${EROOT}"
 	fi
 

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index c1883bf00c1..acd8a7e30fe 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -1435,10 +1435,6 @@ pkg_postinst() {
 	fi
 
 	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# Reload init ... if in a chroot or a diff init package, ignore
-		# errors from this step #253697
-		/sbin/telinit U 2>/dev/null
-
 		use compile-locales || run_locale_gen "${EROOT}"
 	fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-02-03 23:07 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-02-03 23:07 UTC (permalink / raw
  To: gentoo-commits

commit:     9d85df7f7cff28a5cdad2acc78d3bae649d46ed6
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  3 23:00:52 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon Feb  3 23:07:30 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9d85df7f

sys-libs/glibc: bump up to 2.31

Package-Manager: Portage-2.3.87, Repoman-2.3.20
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest          |    2 +
 sys-libs/glibc/glibc-2.31.ebuild | 1491 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 1493 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 304a7131733..3e9b46ae103 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,4 +18,6 @@ DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc
 DIST glibc-2.30-patches-3.tar.xz 20412 BLAKE2B 8cd588284bf07985262a0289d8cbae03b0a75c48110fed6152c0431dc4f729a9695df910b1521a6072e9736b26145bf372d5b60163f64f4556f17f2f9f223e11 SHA512 0da9107518117a1cf901d282f2b84a2f4780130ab9eb7025ffd8b7e629aa6fd5f05b293dd49fc3c300bc2e74e7f81fc1f8a7cb12428b2be086a160d429715758
 DIST glibc-2.30-patches-4.tar.xz 32428 BLAKE2B 7bdcf6f64b22d19b1ef79f466ed0c6e7a289900fbde46eec2a0f4c5458f2088928c1c3f7534eb9794659598d39d2bca21e0922d0cd0f8a459e744abe9197807c SHA512 a80c3a304bcb1acf3a71e5f55782c8aed09747139d6f554bd81b66cef77fcdf33fb943a30cc29e0b9f34cc3d005b08f11f74365b3f9ab32754ce63cbc530ad46
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
+DIST glibc-2.31-patches-1.tar.xz 17796 BLAKE2B ba843ec675b094de63e0d8e76f8583f5a930cc355825aafd013aa650b57c766051ffb1825da8bf46290cb797cf4a7ca1d553e8f8ad3c5518bf499bedd98f1414 SHA512 cdf1238391c2e7973b0d82e37672b49205a273c5d2b1df2b47aba710f7cc5fbebf4fe76af5dd219327e22de62e1ff1c7c36092952a5a80ed6276f869e40dc718
+DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-9999-patches-15.tar.xz 17792 BLAKE2B fe351b7c71418a4707c96fbc6832f831947515bb2ce01fcfa9a9ea410f543a50b8c013e26f10587b283acbab4e988272e8db770112b2961b11c89b20b4a408f7 SHA512 37db45d1d04ad1130319a58d04774a2ada0f026bacd444625782b4dcf5a98a7019a17e132dd1e497968f43fde2c974bbe09a41e164831769a9e95bc8e2117103

diff --git a/sys-libs/glibc/glibc-2.31.ebuild b/sys-libs/glibc/glibc-2.31.ebuild
new file mode 100644
index 00000000000..141efdc9e25
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.31.ebuild
@@ -0,0 +1,1491 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	# needs minimal testing
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=1
+PATCH_DEV=slyfox
+
+SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.0.5
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparc64v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparcv9v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ -n ${ROOT} ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=$(usex ssp all no) )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-02-13 21:40 David Seifert
  0 siblings, 0 replies; 1076+ messages in thread
From: David Seifert @ 2020-02-13 21:40 UTC (permalink / raw
  To: gentoo-commits

commit:     f73e9ef4ad3b741e8cce00e89e578147774d19a4
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 13 21:39:35 2020 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Thu Feb 13 21:39:35 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f73e9ef4

sys-libs/glibc: [QA] inherit toolchain-funcs.eclass directly

Package-Manager: Portage-2.3.88, Repoman-2.3.20
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 sys-libs/glibc/glibc-2.24-r4.ebuild  | 4 ++--
 sys-libs/glibc/glibc-2.25-r11.ebuild | 2 +-
 sys-libs/glibc/glibc-2.26-r7.ebuild  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.24-r4.ebuild b/sys-libs/glibc/glibc-2.24-r4.ebuild
index 790c6acf66c..581f59bd34f 100644
--- a/sys-libs/glibc/glibc-2.24-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.24-r4.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="5"
 
-inherit toolchain-glibc
+inherit toolchain-funcs toolchain-glibc
 
 DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index c1f3510aabb..2bd11b46620 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -3,7 +3,7 @@
 
 EAPI="5"
 
-inherit toolchain-glibc
+inherit toolchain-funcs toolchain-glibc
 
 DESCRIPTION="GNU libc6 (also called glibc2) C library"
 HOMEPAGE="https://www.gnu.org/software/libc/libc.html"

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index b859afdc2fa..fe514d16c02 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=6
 
-inherit prefix toolchain-glibc
+inherit prefix toolchain-funcs toolchain-glibc
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-02-16 14:00 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-02-16 14:00 UTC (permalink / raw
  To: gentoo-commits

commit:     bed1a0fb7ccf7a7a13eea233639b716acc277bd1
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 16 13:59:32 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Feb 16 14:00:07 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bed1a0fb

sys-libs/glibc: add locale-gen call logging

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31.ebuild | 4 +++-
 sys-libs/glibc/glibc-9999.ebuild | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.31.ebuild b/sys-libs/glibc/glibc-2.31.ebuild
index 141efdc9e25..d951ee59a36 100644
--- a/sys-libs/glibc/glibc-2.31.ebuild
+++ b/sys-libs/glibc/glibc-2.31.ebuild
@@ -1178,8 +1178,10 @@ run_locale_gen() {
 		locale_list="${root}/usr/share/i18n/SUPPORTED"
 	fi
 
-	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
 		--destdir "${root}"
+	echo "$@"
+	"$@"
 
 	popd >/dev/null
 }

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 819acaf2854..fb9790efbb5 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1177,8 +1177,10 @@ run_locale_gen() {
 		locale_list="${root}/usr/share/i18n/SUPPORTED"
 	fi
 
-	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
 		--destdir "${root}"
+	echo "$@"
+	"$@"
 
 	popd >/dev/null
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-02-16 19:25 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-02-16 19:25 UTC (permalink / raw
  To: gentoo-commits

commit:     9097e0e8399937b751ac38153f44a12f9f1c2b54
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 16 19:23:13 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Feb 16 19:25:25 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9097e0e8

sys-libs/glibc: pull 2.30 and 2.31 upstream patches, bug #708758

Among other things patches to fix posix_spawn syscall on mips
and other targets..

Reported-by: Joshua Kinard
Closes: https://bugs.gentoo.org/708758
Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 +
 sys-libs/glibc/glibc-2.30-r4.ebuild | 1490 ++++++++++++++++++++++++++++++++++
 sys-libs/glibc/glibc-2.31-r1.ebuild | 1493 +++++++++++++++++++++++++++++++++++
 3 files changed, 2985 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 3e9b46ae103..abcf78681bc 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,7 +17,9 @@ DIST glibc-2.29-patches-8.tar.xz 102712 BLAKE2B 49aacff358c0f8499c444e73eec92f40
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-3.tar.xz 20412 BLAKE2B 8cd588284bf07985262a0289d8cbae03b0a75c48110fed6152c0431dc4f729a9695df910b1521a6072e9736b26145bf372d5b60163f64f4556f17f2f9f223e11 SHA512 0da9107518117a1cf901d282f2b84a2f4780130ab9eb7025ffd8b7e629aa6fd5f05b293dd49fc3c300bc2e74e7f81fc1f8a7cb12428b2be086a160d429715758
 DIST glibc-2.30-patches-4.tar.xz 32428 BLAKE2B 7bdcf6f64b22d19b1ef79f466ed0c6e7a289900fbde46eec2a0f4c5458f2088928c1c3f7534eb9794659598d39d2bca21e0922d0cd0f8a459e744abe9197807c SHA512 a80c3a304bcb1acf3a71e5f55782c8aed09747139d6f554bd81b66cef77fcdf33fb943a30cc29e0b9f34cc3d005b08f11f74365b3f9ab32754ce63cbc530ad46
+DIST glibc-2.30-patches-5.tar.xz 62504 BLAKE2B 19797021000cbf0951144aa7d72b3a16c8e21677f3af8a34dba2813d1547b9773d50412492dec9c0be50c4734fdc49459a482bb2724f06bbe0be4729f19aff28 SHA512 58567963b3802aa3f51a4a462557b89fc46c930b3a0613536e650a66f95cadaa96305a2ba0d59acf2c959ceda64aa7089e86b60cd0e3e68af68612c38c96b9d6
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-1.tar.xz 17796 BLAKE2B ba843ec675b094de63e0d8e76f8583f5a930cc355825aafd013aa650b57c766051ffb1825da8bf46290cb797cf4a7ca1d553e8f8ad3c5518bf499bedd98f1414 SHA512 cdf1238391c2e7973b0d82e37672b49205a273c5d2b1df2b47aba710f7cc5fbebf4fe76af5dd219327e22de62e1ff1c7c36092952a5a80ed6276f869e40dc718
+DIST glibc-2.31-patches-2.tar.xz 23736 BLAKE2B 181ba7f774e2964efdbe6f9f0540c27e18afe76854efcad3be5e5c277cf2e671d0f21752d1d42cb82f1e60a58f76f89a4997c12b74585f88ecbab85dff459c63 SHA512 1e9ae2e0cfffd80cc7219a7f989e18987b0ecaaa6e92516f823c7f3febb8fb5c86d8d9c3d9fecb98fdda699f6d7b00660d6ca3f2fee84db60f16a76d723d0b7e
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-9999-patches-15.tar.xz 17792 BLAKE2B fe351b7c71418a4707c96fbc6832f831947515bb2ce01fcfa9a9ea410f543a50b8c013e26f10587b283acbab4e988272e8db770112b2961b11c89b20b4a408f7 SHA512 37db45d1d04ad1130319a58d04774a2ada0f026bacd444625782b4dcf5a98a7019a17e132dd1e497968f43fde2c974bbe09a41e164831769a9e95bc8e2117103

diff --git a/sys-libs/glibc/glibc-2.30-r4.ebuild b/sys-libs/glibc/glibc-2.30-r4.ebuild
new file mode 100644
index 00000000000..807c5b3944d
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.30-r4.ebuild
@@ -0,0 +1,1490 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=5
+PATCH_DEV=slyfox
+
+SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.0.5
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparc64v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparcv9v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ -n ${ROOT} ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=$(usex ssp all no) )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}

diff --git a/sys-libs/glibc/glibc-2.31-r1.ebuild b/sys-libs/glibc/glibc-2.31-r1.ebuild
new file mode 100644
index 00000000000..14d8f5289a1
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.31-r1.ebuild
@@ -0,0 +1,1493 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	# needs minimal testing
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=2
+PATCH_DEV=slyfox
+
+SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.0.5
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparc64v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparcv9v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ -n ${ROOT} ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=$(usex ssp all no) )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-09 10:07 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-03-09 10:07 UTC (permalink / raw
  To: gentoo-commits

commit:     8cb24dc61b0ecd1978bc2d83133886543690c092
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  9 10:06:53 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Mar  9 10:07:18 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8cb24dc6

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    3 -
 sys-libs/glibc/glibc-2.30-r2.ebuild | 1488 ----------------------------------
 sys-libs/glibc/glibc-2.30-r3.ebuild | 1490 ----------------------------------
 sys-libs/glibc/glibc-2.31.ebuild    | 1493 -----------------------------------
 4 files changed, 4474 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index abcf78681bc..a4e248717a2 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,11 +15,8 @@ DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79
 DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525eccfec462d638dbc25c581e5b7a2a72ffd5191842f5ac443a868cbc950838d7e5120e866d343a14b80c55dcbfa48f30 SHA512 4c9b78d9d1a8aa629418f2d758ef800857780b8a1fd8d3582b88348a513ca26ca7f6ac9110a8c6bae16949b360ba36840d184f42293cd4324760273592d1b438
 DIST glibc-2.29-patches-8.tar.xz 102712 BLAKE2B 49aacff358c0f8499c444e73eec92f402b81236d6a91d1fc9864f974c5cb72fc5c87bf5ee77700a8333db4c68892b3940948158530cea0d0fbbda51df0ae7953 SHA512 7a929e023294e6b76569120cc234bc862f3e260994e56c3a2fc2b969b7313c94a47de7ef85f4e93c9083c16fde987ca470ab9d69d881ab49a22f5fd3a721703a
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
-DIST glibc-2.30-patches-3.tar.xz 20412 BLAKE2B 8cd588284bf07985262a0289d8cbae03b0a75c48110fed6152c0431dc4f729a9695df910b1521a6072e9736b26145bf372d5b60163f64f4556f17f2f9f223e11 SHA512 0da9107518117a1cf901d282f2b84a2f4780130ab9eb7025ffd8b7e629aa6fd5f05b293dd49fc3c300bc2e74e7f81fc1f8a7cb12428b2be086a160d429715758
-DIST glibc-2.30-patches-4.tar.xz 32428 BLAKE2B 7bdcf6f64b22d19b1ef79f466ed0c6e7a289900fbde46eec2a0f4c5458f2088928c1c3f7534eb9794659598d39d2bca21e0922d0cd0f8a459e744abe9197807c SHA512 a80c3a304bcb1acf3a71e5f55782c8aed09747139d6f554bd81b66cef77fcdf33fb943a30cc29e0b9f34cc3d005b08f11f74365b3f9ab32754ce63cbc530ad46
 DIST glibc-2.30-patches-5.tar.xz 62504 BLAKE2B 19797021000cbf0951144aa7d72b3a16c8e21677f3af8a34dba2813d1547b9773d50412492dec9c0be50c4734fdc49459a482bb2724f06bbe0be4729f19aff28 SHA512 58567963b3802aa3f51a4a462557b89fc46c930b3a0613536e650a66f95cadaa96305a2ba0d59acf2c959ceda64aa7089e86b60cd0e3e68af68612c38c96b9d6
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
-DIST glibc-2.31-patches-1.tar.xz 17796 BLAKE2B ba843ec675b094de63e0d8e76f8583f5a930cc355825aafd013aa650b57c766051ffb1825da8bf46290cb797cf4a7ca1d553e8f8ad3c5518bf499bedd98f1414 SHA512 cdf1238391c2e7973b0d82e37672b49205a273c5d2b1df2b47aba710f7cc5fbebf4fe76af5dd219327e22de62e1ff1c7c36092952a5a80ed6276f869e40dc718
 DIST glibc-2.31-patches-2.tar.xz 23736 BLAKE2B 181ba7f774e2964efdbe6f9f0540c27e18afe76854efcad3be5e5c277cf2e671d0f21752d1d42cb82f1e60a58f76f89a4997c12b74585f88ecbab85dff459c63 SHA512 1e9ae2e0cfffd80cc7219a7f989e18987b0ecaaa6e92516f823c7f3febb8fb5c86d8d9c3d9fecb98fdda699f6d7b00660d6ca3f2fee84db60f16a76d723d0b7e
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-9999-patches-15.tar.xz 17792 BLAKE2B fe351b7c71418a4707c96fbc6832f831947515bb2ce01fcfa9a9ea410f543a50b8c013e26f10587b283acbab4e988272e8db770112b2961b11c89b20b4a408f7 SHA512 37db45d1d04ad1130319a58d04774a2ada0f026bacd444625782b4dcf5a98a7019a17e132dd1e497968f43fde2c974bbe09a41e164831769a9e95bc8e2117103

diff --git a/sys-libs/glibc/glibc-2.30-r2.ebuild b/sys-libs/glibc/glibc-2.30-r2.ebuild
deleted file mode 100644
index b357fd43e0a..00000000000
--- a/sys-libs/glibc/glibc-2.30-r2.ebuild
+++ /dev/null
@@ -1,1488 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=3
-
-SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ -n ${ROOT} ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all no) )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.30-r3.ebuild b/sys-libs/glibc/glibc-2.30-r3.ebuild
deleted file mode 100644
index d1da04b428a..00000000000
--- a/sys-libs/glibc/glibc-2.30-r3.ebuild
+++ /dev/null
@@ -1,1490 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7,8} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=4
-PATCH_DEV=dilfridge
-
-SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ -n ${ROOT} ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all no) )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.31.ebuild b/sys-libs/glibc/glibc-2.31.ebuild
deleted file mode 100644
index d951ee59a36..00000000000
--- a/sys-libs/glibc/glibc-2.31.ebuild
+++ /dev/null
@@ -1,1493 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7,8} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	# needs minimal testing
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=1
-PATCH_DEV=slyfox
-
-SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ -n ${ROOT} ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all no) )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-10  7:35 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-03-10  7:35 UTC (permalink / raw
  To: gentoo-commits

commit:     3e796f4abbb89a6edc99b54688f666ec11219ea2
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 10 07:33:36 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Mar 10 07:35:06 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3e796f4a

sys-libs/glibc: fix live ebuild link

https:// scema is not supported by sourceware's git. Use git:// instead.

Package-Manager: Portage-2.3.93, Repoman-2.3.20
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index fb9790efbb5..70a236147ae 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -16,7 +16,8 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	# sourceware.org does not have https:// today.
+	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
 	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-12 16:27 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-03-12 16:27 UTC (permalink / raw
  To: gentoo-commits

commit:     2405291e43b9b18b1f0e89898d9d94707cdcc769
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 12 16:25:53 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Mar 12 16:27:01 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2405291e

sys-libs/glibc: Revision bump with new patchset 6

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.30-r5.ebuild | 1490 +++++++++++++++++++++++++++++++++++
 2 files changed, 1491 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index a4e248717a2..da9301fc7bf 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,6 +16,7 @@ DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525
 DIST glibc-2.29-patches-8.tar.xz 102712 BLAKE2B 49aacff358c0f8499c444e73eec92f402b81236d6a91d1fc9864f974c5cb72fc5c87bf5ee77700a8333db4c68892b3940948158530cea0d0fbbda51df0ae7953 SHA512 7a929e023294e6b76569120cc234bc862f3e260994e56c3a2fc2b969b7313c94a47de7ef85f4e93c9083c16fde987ca470ab9d69d881ab49a22f5fd3a721703a
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-5.tar.xz 62504 BLAKE2B 19797021000cbf0951144aa7d72b3a16c8e21677f3af8a34dba2813d1547b9773d50412492dec9c0be50c4734fdc49459a482bb2724f06bbe0be4729f19aff28 SHA512 58567963b3802aa3f51a4a462557b89fc46c930b3a0613536e650a66f95cadaa96305a2ba0d59acf2c959ceda64aa7089e86b60cd0e3e68af68612c38c96b9d6
+DIST glibc-2.30-patches-6.tar.xz 66612 BLAKE2B 21ce2de45c1bd847ddf0e4e848e0d7adccc77eb91d452b9a81404b46c44ae681f31f8f41c156a782ec9390cf0d5f4d741f6a393ff6dca65b8091f126c1a30623 SHA512 0871ae71a67b21339055ac05dcb634f3b705ae44c10e7ac51e19f15196232349ed9b79a856c5e9f681dd44f9b946bbbfe170e9195819e76d0ca95dba7cede71b
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-2.tar.xz 23736 BLAKE2B 181ba7f774e2964efdbe6f9f0540c27e18afe76854efcad3be5e5c277cf2e671d0f21752d1d42cb82f1e60a58f76f89a4997c12b74585f88ecbab85dff459c63 SHA512 1e9ae2e0cfffd80cc7219a7f989e18987b0ecaaa6e92516f823c7f3febb8fb5c86d8d9c3d9fecb98fdda699f6d7b00660d6ca3f2fee84db60f16a76d723d0b7e
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306

diff --git a/sys-libs/glibc/glibc-2.30-r5.ebuild b/sys-libs/glibc/glibc-2.30-r5.ebuild
new file mode 100644
index 00000000000..f6a47c791e1
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.30-r5.ebuild
@@ -0,0 +1,1490 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=6
+PATCH_DEV=dilfridge
+
+SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-devel/bison-2.7
+	!<sys-devel/make-4
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.0.5
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparc64v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparcv9v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ -n ${ROOT} ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=$(usex ssp all no) )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-14  9:54 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-03-14  9:54 UTC (permalink / raw
  To: gentoo-commits

commit:     a6aac4bf276a0338c18fccd41d48ad7952f0a731
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 14 09:26:18 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Mar 14 09:54:13 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6aac4bf

sys-libs/glibc: add USE=static-pie to install rcrt1.o

To add support for gcc's -static-pie flag glibc needs
to provide a few runtile files like rcrt1.o. Let's install
those when requested.

Noticed when looked at static-pie failures in bug #712356.
The change should not fix test failures, but will provide
a way to easily sanity-check static-pie health with minimal
test.

Bug: https://bugs.gentoo.org/712356
Package-Manager: Portage-2.3.93, Repoman-2.3.20
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r1.ebuild | 6 ++++--
 sys-libs/glibc/glibc-9999.ebuild    | 3 ++-
 sys-libs/glibc/metadata.xml         | 1 +
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.31-r1.ebuild b/sys-libs/glibc/glibc-2.31-r1.ebuild
index 14d8f5289a1..97ad95166d0 100644
--- a/sys-libs/glibc/glibc-2.31-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r1.ebuild
@@ -16,7 +16,8 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	# sourceware.org does not have https:// today.
+	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
 	# needs minimal testing
@@ -35,7 +36,7 @@ PATCH_DEV=slyfox
 SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+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"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -942,6 +943,7 @@ 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)
 		${EXTRA_ECONF}

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 70a236147ae..0090072dba2 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -35,7 +35,7 @@ PATCH_VER=15
 SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
-IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+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"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -942,6 +942,7 @@ 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)
 		${EXTRA_ECONF}

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index b00c5f56e58..6630fde73e7 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -15,6 +15,7 @@
  <flag name="nscd">Build, and enable support for, the Name Service Cache Daemon</flag>
  <flag name="rpc">Enable obsolete RPC/NIS layers</flag>
  <flag name="ssp">protect stack of glibc internals</flag>
+ <flag name="static-pie">Enable static PIE support (runtime files for -static-pie gcc option).</flag>
  <flag name="suid">Make internal pt_chown helper setuid -- not needed if using Linux and have /dev/pts mounted with gid=5</flag>
  <flag name="systemtap">enable systemtap static probe points</flag>
 </use>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-14  9:54 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-03-14  9:54 UTC (permalink / raw
  To: gentoo-commits

commit:     46fc0149867e9195225223c553e72fa99fce58ee
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 14 09:28:30 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Mar 14 09:54:13 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=46fc0149

sys-libs/glibc: drop outdated '!<sys-devel/make-4' blocker

Package-Manager: Portage-2.3.93, Repoman-2.3.20
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.28-r6.ebuild | 1 -
 sys-libs/glibc/glibc-2.29-r2.ebuild | 1 -
 sys-libs/glibc/glibc-2.29-r7.ebuild | 1 -
 sys-libs/glibc/glibc-2.30-r4.ebuild | 1 -
 sys-libs/glibc/glibc-2.30-r5.ebuild | 1 -
 sys-libs/glibc/glibc-2.31-r1.ebuild | 1 -
 sys-libs/glibc/glibc-9999.ebuild    | 1 -
 7 files changed, 7 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
index d39698a15a8..c31d58fa7cf 100644
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.28-r6.ebuild
@@ -96,7 +96,6 @@ DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
 	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
 	doc? ( sys-apps/texinfo )
 	test? ( >=net-dns/libidn2-2.0.5 )
 "

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
index acd8a7e30fe..6265efcd469 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -99,7 +99,6 @@ DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
 	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
 	doc? ( sys-apps/texinfo )
 	test? ( >=net-dns/libidn2-2.0.5 )
 "

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
index 18e81921055..5ceed365c53 100644
--- a/sys-libs/glibc/glibc-2.29-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild
@@ -89,7 +89,6 @@ BDEPEND="
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
 	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
 	doc? ( sys-apps/texinfo )
 "
 COMMON_DEPEND="

diff --git a/sys-libs/glibc/glibc-2.30-r4.ebuild b/sys-libs/glibc/glibc-2.30-r4.ebuild
index 807c5b3944d..def7dd491a3 100644
--- a/sys-libs/glibc/glibc-2.30-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r4.ebuild
@@ -89,7 +89,6 @@ BDEPEND="
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
 	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
 	doc? ( sys-apps/texinfo )
 "
 COMMON_DEPEND="

diff --git a/sys-libs/glibc/glibc-2.30-r5.ebuild b/sys-libs/glibc/glibc-2.30-r5.ebuild
index f6a47c791e1..b9770042b98 100644
--- a/sys-libs/glibc/glibc-2.30-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r5.ebuild
@@ -89,7 +89,6 @@ BDEPEND="
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
 	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
 	doc? ( sys-apps/texinfo )
 "
 COMMON_DEPEND="

diff --git a/sys-libs/glibc/glibc-2.31-r1.ebuild b/sys-libs/glibc/glibc-2.31-r1.ebuild
index 97ad95166d0..73704b785a2 100644
--- a/sys-libs/glibc/glibc-2.31-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r1.ebuild
@@ -91,7 +91,6 @@ BDEPEND="
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
 	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
 	doc? ( sys-apps/texinfo )
 "
 COMMON_DEPEND="

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 0090072dba2..8e449fe1360 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -90,7 +90,6 @@ BDEPEND="
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
 	!<sys-devel/bison-2.7
-	!<sys-devel/make-4
 	doc? ( sys-apps/texinfo )
 "
 COMMON_DEPEND="


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-14 18:16 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-03-14 18:16 UTC (permalink / raw
  To: gentoo-commits

commit:     0fd66225cdf23f8e948558f85e0d7fd9f2af96f3
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 14 18:11:28 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Mar 14 18:16:20 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0fd66225

sys-libs/glibc: refresh live patchset

Package-Manager: Portage-2.3.93, Repoman-2.3.20
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index da9301fc7bf..04023c7473d 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,4 +20,4 @@ DIST glibc-2.30-patches-6.tar.xz 66612 BLAKE2B 21ce2de45c1bd847ddf0e4e848e0d7adc
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-2.tar.xz 23736 BLAKE2B 181ba7f774e2964efdbe6f9f0540c27e18afe76854efcad3be5e5c277cf2e671d0f21752d1d42cb82f1e60a58f76f89a4997c12b74585f88ecbab85dff459c63 SHA512 1e9ae2e0cfffd80cc7219a7f989e18987b0ecaaa6e92516f823c7f3febb8fb5c86d8d9c3d9fecb98fdda699f6d7b00660d6ca3f2fee84db60f16a76d723d0b7e
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
-DIST glibc-9999-patches-15.tar.xz 17792 BLAKE2B fe351b7c71418a4707c96fbc6832f831947515bb2ce01fcfa9a9ea410f543a50b8c013e26f10587b283acbab4e988272e8db770112b2961b11c89b20b4a408f7 SHA512 37db45d1d04ad1130319a58d04774a2ada0f026bacd444625782b4dcf5a98a7019a17e132dd1e497968f43fde2c974bbe09a41e164831769a9e95bc8e2117103
+DIST glibc-9999-patches-16.tar.xz 17736 BLAKE2B 772f5012ead8e27f5cf5fd2613de9a76ead2128ecd9324cc499e677ea3a96110cb0d4b1d3f12860ffa1267093db310503d7d873fb95060b0c1e046c6a60601d0 SHA512 eb885b7743ac88df7e9eb3a1cd415bc9eabff1c6bd00d32c4e50f1d9dfcc32419eb72ef06749b279d5b80a200a83bc951a851b8c96a023ab09a8a0c28045d563

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 8e449fe1360..a457c751d18 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -30,7 +30,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=15
+PATCH_VER=16
 
 SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-15 12:47 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2020-03-15 12:47 UTC (permalink / raw
  To: gentoo-commits

commit:     1fbcbf65a8e10e4ee81b264174ee425cd0bd4807
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 15 12:47:09 2020 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Sun Mar 15 12:47:09 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1fbcbf65

sys-libs/glibc: sh stable wrt bug #702484

Package-Manager: Portage-2.3.89, Repoman-2.3.20
RepoMan-Options: --include-arches="sh"
Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
index 5ceed365c53..cdc045a5834 100644
--- a/sys-libs/glibc/glibc-2.29-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~riscv s390 ~sh sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sh sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-15 13:50 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-03-15 13:50 UTC (permalink / raw
  To: gentoo-commits

commit:     959cf0a3b9fbb0de4181bb128a9c484d9f0153f1
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 15 13:50:35 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Mar 15 13:50:47 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=959cf0a3

sys-libs/glibc: disable container tests, bug #712356

sandbox is not very compatible with filesystem unshare().
It can't check if mkdir(/proc) is a safe operation under
unshare/chroot. Let's disable container tests.

One day we can enable them if not running under sandbox.

Shoul deal with the following test failures:

    FAIL: elf/tst-dlopen-self-container
    FAIL: elf/tst-dlopen-tlsmodid-container
    FAIL: elf/tst-ifunc-fault-bindnow
    FAIL: elf/tst-ifunc-fault-lazy
    FAIL: elf/tst-ldconfig-bad-aux-cache
    FAIL: elf/tst-ldconfig-ld_so_conf-update
    FAIL: elf/tst-pldd

Reported-by: Toralf Förster
Bug: https://bugs.gentoo.org/712356
Package-Manager: Portage-2.3.94, Repoman-2.3.20
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r1.ebuild | 6 +++++-
 sys-libs/glibc/glibc-9999.ebuild    | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.31-r1.ebuild b/sys-libs/glibc/glibc-2.31-r1.ebuild
index 73704b785a2..d303115a4a6 100644
--- a/sys-libs/glibc/glibc-2.31-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r1.ebuild
@@ -1137,7 +1137,11 @@ src_compile() {
 
 glibc_src_test() {
 	cd "$(builddir nptl)"
-	emake check
+	# disable tests:
+	# - tests-container:
+	#     sandbox does not understand unshare() and prevents
+	#     writes to /proc/
+	emake check tests-container=
 }
 
 do_src_test() {

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a457c751d18..229af08f2ca 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1136,7 +1136,11 @@ src_compile() {
 
 glibc_src_test() {
 	cd "$(builddir nptl)"
-	emake check
+	# disable tests:
+	# - tests-container:
+	#     sandbox does not understand unshare() and prevents
+	#     writes to /proc/
+	emake check tests-container=
 }
 
 do_src_test() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-15 15:46 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-03-15 15:46 UTC (permalink / raw
  To: gentoo-commits

commit:     551958422d949b8e43393b6c9c00a2ce7c4cc4c6
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 15 15:17:09 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Mar 15 15:46:25 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=55195842

sys-libs/glibc: switch -fstack-protector-all to -strong, bug #712356

--enable-stack-protector=all adds protection to functions that don't
have a chance to corrupt stack. On top of that glibc's own tests fail
on static IFUNC resolver.

Let's use -fstack-protector-strong which matches Gentoo's gcc default.

Should fix at least the following test failures:
    FAIL: elf/ifuncmain9picstatic
    FAIL: elf/ifuncmain9static

Reported-by: Toralf Förster
Bug: https://bugs.gentoo.org/712356
Bug: https://sourceware.org/PR25680
Package-Manager: Portage-2.3.94, Repoman-2.3.20
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r1.ebuild | 6 +++++-
 sys-libs/glibc/glibc-9999.ebuild    | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.31-r1.ebuild b/sys-libs/glibc/glibc-2.31-r1.ebuild
index d303115a4a6..00feda902bd 100644
--- a/sys-libs/glibc/glibc-2.31-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r1.ebuild
@@ -870,7 +870,11 @@ glibc_do_configure() {
 			myconf+=( --enable-stack-protector=no )
 			;;
 		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all 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 )

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 229af08f2ca..b77e0177feb 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -869,7 +869,11 @@ glibc_do_configure() {
 			myconf+=( --enable-stack-protector=no )
 			;;
 		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all 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 )


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-16 21:23 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-03-16 21:23 UTC (permalink / raw
  To: gentoo-commits

commit:     2dcabf30efc3ee268c2a90a73eca0bc6d378bced
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Mon Mar 16 18:56:26 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon Mar 16 21:23:52 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2dcabf30

sys-libs/glibc: Use https:// again for git repository.

Reverts: 3e796f4abbb89a6edc99b54688f666ec11219ea2
Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.24-r4.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.25-r11.ebuild | 2 +-
 sys-libs/glibc/glibc-2.26-r7.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.31-r1.ebuild  | 3 +--
 sys-libs/glibc/glibc-9999.ebuild     | 3 +--
 5 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.24-r4.ebuild b/sys-libs/glibc/glibc-2.24-r4.ebuild
index 581f59bd34f..d6831c0403b 100644
--- a/sys-libs/glibc/glibc-2.24-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.24-r4.ebuild
@@ -16,7 +16,7 @@ EMULTILIB_PKG="true"
 RELEASE_VER=""
 case ${PV} in
 9999*)
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+	EGIT_REPO_URIS="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 	;;
 *)

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
index 2bd11b46620..8c30e398b3e 100644
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.25-r11.ebuild
@@ -16,7 +16,7 @@ EMULTILIB_PKG="true"
 RELEASE_VER=""
 case ${PV} in
 9999*)
-	EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+	EGIT_REPO_URIS="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 	;;
 *)

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
index fe514d16c02..2dd4e66f29b 100644
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild
@@ -14,7 +14,7 @@ EMULTILIB_PKG="true"
 # Configuration variables
 
 if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
 	KEYWORDS="~alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"

diff --git a/sys-libs/glibc/glibc-2.31-r1.ebuild b/sys-libs/glibc/glibc-2.31-r1.ebuild
index 00feda902bd..54758a65602 100644
--- a/sys-libs/glibc/glibc-2.31-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r1.ebuild
@@ -16,8 +16,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 if [[ ${PV} == 9999* ]]; then
-	# sourceware.org does not have https:// today.
-	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
 	# needs minimal testing

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index b77e0177feb..7af2bc9cf75 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -16,8 +16,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 if [[ ${PV} == 9999* ]]; then
-	# sourceware.org does not have https:// today.
-	EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
 	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-19 20:58 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-03-19 20:58 UTC (permalink / raw
  To: gentoo-commits

commit:     fab50d17c72ef819a7bc0c4ee652b63f9d61f054
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 19 20:57:27 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Mar 19 20:58:05 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fab50d17

sys-libs/glibc: 2.30 revbump: patch 7, enable-stack-protector=strong

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.30-r6.ebuild | 1493 +++++++++++++++++++++++++++++++++++
 2 files changed, 1494 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 04023c7473d..ab5a0f5cf36 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,6 +17,7 @@ DIST glibc-2.29-patches-8.tar.xz 102712 BLAKE2B 49aacff358c0f8499c444e73eec92f40
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-5.tar.xz 62504 BLAKE2B 19797021000cbf0951144aa7d72b3a16c8e21677f3af8a34dba2813d1547b9773d50412492dec9c0be50c4734fdc49459a482bb2724f06bbe0be4729f19aff28 SHA512 58567963b3802aa3f51a4a462557b89fc46c930b3a0613536e650a66f95cadaa96305a2ba0d59acf2c959ceda64aa7089e86b60cd0e3e68af68612c38c96b9d6
 DIST glibc-2.30-patches-6.tar.xz 66612 BLAKE2B 21ce2de45c1bd847ddf0e4e848e0d7adccc77eb91d452b9a81404b46c44ae681f31f8f41c156a782ec9390cf0d5f4d741f6a393ff6dca65b8091f126c1a30623 SHA512 0871ae71a67b21339055ac05dcb634f3b705ae44c10e7ac51e19f15196232349ed9b79a856c5e9f681dd44f9b946bbbfe170e9195819e76d0ca95dba7cede71b
+DIST glibc-2.30-patches-7.tar.xz 70632 BLAKE2B 5442262a4566a18a9a43fa5348365e6299873db320aa6e530ab8ded27cbac137ccbbccf8f0d7954facc6650fea935c9824ea94d69619e30cff9d17b912dec77e SHA512 d33787dcc0e1b4a45e91babe3b87cf979fa5f32d1b285d8f1d0d13729a692606ff65527d5c189f0b3b3c1bec735fda40682399eb8d66897dad49101ddfa195ec
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-2.tar.xz 23736 BLAKE2B 181ba7f774e2964efdbe6f9f0540c27e18afe76854efcad3be5e5c277cf2e671d0f21752d1d42cb82f1e60a58f76f89a4997c12b74585f88ecbab85dff459c63 SHA512 1e9ae2e0cfffd80cc7219a7f989e18987b0ecaaa6e92516f823c7f3febb8fb5c86d8d9c3d9fecb98fdda699f6d7b00660d6ca3f2fee84db60f16a76d723d0b7e
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306

diff --git a/sys-libs/glibc/glibc-2.30-r6.ebuild b/sys-libs/glibc/glibc-2.30-r6.ebuild
new file mode 100644
index 00000000000..2740fe7453b
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.30-r6.ebuild
@@ -0,0 +1,1493 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=7
+PATCH_DEV=dilfridge
+
+SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-devel/bison-2.7
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.0.5
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparc64v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparcv9v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ -n ${ROOT} ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-20 15:30 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-03-20 15:30 UTC (permalink / raw
  To: gentoo-commits

commit:     bebea707eeeb62bbee333cb4e4981af8ebd32985
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 19 21:32:06 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Mar 20 15:30:19 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bebea707

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 -
 sys-libs/glibc/glibc-2.29-r2.ebuild | 1454 ----------------------------------
 sys-libs/glibc/glibc-2.30-r4.ebuild | 1489 -----------------------------------
 3 files changed, 2945 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index ab5a0f5cf36..dcd0e760f61 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -12,10 +12,8 @@ DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 4ab583be712994f949dee2512da6e12fd7f7ad73e96393f21678552b43da98f49321b53b5b009551300cdb09ca135e7f6adc636ff750c251a1d6d7f262dbc410 SHA512 e3f40ae6e9d06471c1a11bd2bce7b5161d07c3d0a81791505a72aec4817e7faf9ef09841e98c6dcf62a0a00754dff87dd194d97ac6b6354aeb2497cf60900b96
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
-DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525eccfec462d638dbc25c581e5b7a2a72ffd5191842f5ac443a868cbc950838d7e5120e866d343a14b80c55dcbfa48f30 SHA512 4c9b78d9d1a8aa629418f2d758ef800857780b8a1fd8d3582b88348a513ca26ca7f6ac9110a8c6bae16949b360ba36840d184f42293cd4324760273592d1b438
 DIST glibc-2.29-patches-8.tar.xz 102712 BLAKE2B 49aacff358c0f8499c444e73eec92f402b81236d6a91d1fc9864f974c5cb72fc5c87bf5ee77700a8333db4c68892b3940948158530cea0d0fbbda51df0ae7953 SHA512 7a929e023294e6b76569120cc234bc862f3e260994e56c3a2fc2b969b7313c94a47de7ef85f4e93c9083c16fde987ca470ab9d69d881ab49a22f5fd3a721703a
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
-DIST glibc-2.30-patches-5.tar.xz 62504 BLAKE2B 19797021000cbf0951144aa7d72b3a16c8e21677f3af8a34dba2813d1547b9773d50412492dec9c0be50c4734fdc49459a482bb2724f06bbe0be4729f19aff28 SHA512 58567963b3802aa3f51a4a462557b89fc46c930b3a0613536e650a66f95cadaa96305a2ba0d59acf2c959ceda64aa7089e86b60cd0e3e68af68612c38c96b9d6
 DIST glibc-2.30-patches-6.tar.xz 66612 BLAKE2B 21ce2de45c1bd847ddf0e4e848e0d7adccc77eb91d452b9a81404b46c44ae681f31f8f41c156a782ec9390cf0d5f4d741f6a393ff6dca65b8091f126c1a30623 SHA512 0871ae71a67b21339055ac05dcb634f3b705ae44c10e7ac51e19f15196232349ed9b79a856c5e9f681dd44f9b946bbbfe170e9195819e76d0ca95dba7cede71b
 DIST glibc-2.30-patches-7.tar.xz 70632 BLAKE2B 5442262a4566a18a9a43fa5348365e6299873db320aa6e530ab8ded27cbac137ccbbccf8f0d7954facc6650fea935c9824ea94d69619e30cff9d17b912dec77e SHA512 d33787dcc0e1b4a45e91babe3b87cf979fa5f32d1b285d8f1d0d13729a692606ff65527d5c189f0b3b3c1bec735fda40682399eb8d66897dad49101ddfa195ec
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b

diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild b/sys-libs/glibc/glibc-2.29-r2.ebuild
deleted file mode 100644
index 6265efcd469..00000000000
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ /dev/null
@@ -1,1454 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-PYTHON_COMPAT=( python3_{6,7} )
-
-inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 ~riscv s390 sh sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=3
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we disable stripping
-# entirely.
-RESTRICT="strip !test? ( test )"
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-devel/bison-2.7
-	doc? ( sys-apps/texinfo )
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-		virtual/os-headers
-	"
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all no) )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-		locale_list="${root}/usr/share/i18n/SUPPORTED"
-	fi
-
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.30-r4.ebuild b/sys-libs/glibc/glibc-2.30-r4.ebuild
deleted file mode 100644
index def7dd491a3..00000000000
--- a/sys-libs/glibc/glibc-2.30-r4.ebuild
+++ /dev/null
@@ -1,1489 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7,8} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=5
-PATCH_DEV=slyfox
-
-SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-devel/bison-2.7
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ -n ${ROOT} ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all no) )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-21 23:17 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-03-21 23:17 UTC (permalink / raw
  To: gentoo-commits

commit:     7626824f263d24828f393251fc357fe6060b85f5
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 21 21:42:02 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Mar 21 23:16:50 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7626824f

sys-libs/glibc: Fixes in 2.30 testsuite

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |  2 +-
 sys-libs/glibc/glibc-2.30-r6.ebuild | 32 ++++++++++++++++++++++++++++++--
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index dcd0e760f61..bbdde0350f7 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,7 +15,7 @@ DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79
 DIST glibc-2.29-patches-8.tar.xz 102712 BLAKE2B 49aacff358c0f8499c444e73eec92f402b81236d6a91d1fc9864f974c5cb72fc5c87bf5ee77700a8333db4c68892b3940948158530cea0d0fbbda51df0ae7953 SHA512 7a929e023294e6b76569120cc234bc862f3e260994e56c3a2fc2b969b7313c94a47de7ef85f4e93c9083c16fde987ca470ab9d69d881ab49a22f5fd3a721703a
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-6.tar.xz 66612 BLAKE2B 21ce2de45c1bd847ddf0e4e848e0d7adccc77eb91d452b9a81404b46c44ae681f31f8f41c156a782ec9390cf0d5f4d741f6a393ff6dca65b8091f126c1a30623 SHA512 0871ae71a67b21339055ac05dcb634f3b705ae44c10e7ac51e19f15196232349ed9b79a856c5e9f681dd44f9b946bbbfe170e9195819e76d0ca95dba7cede71b
-DIST glibc-2.30-patches-7.tar.xz 70632 BLAKE2B 5442262a4566a18a9a43fa5348365e6299873db320aa6e530ab8ded27cbac137ccbbccf8f0d7954facc6650fea935c9824ea94d69619e30cff9d17b912dec77e SHA512 d33787dcc0e1b4a45e91babe3b87cf979fa5f32d1b285d8f1d0d13729a692606ff65527d5c189f0b3b3c1bec735fda40682399eb8d66897dad49101ddfa195ec
+DIST glibc-2.30-patches-8.tar.xz 71432 BLAKE2B 149ea765ca1aceafc3237db7362766503a0a1e5c59e82781023bf3da59690502997acebbbeca8712c8c19070951268321affe929d8777b5f3ab3e4f01bb6375f SHA512 6e953a21f858edabe03713951f7b9435d0329ad652b70836911f6a3dc8d49661f03d8f98315ded127af8be315c5ba928a94bc54cfdf37d48a5f9d1e7f9b4f92e
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-2.tar.xz 23736 BLAKE2B 181ba7f774e2964efdbe6f9f0540c27e18afe76854efcad3be5e5c277cf2e671d0f21752d1d42cb82f1e60a58f76f89a4997c12b74585f88ecbab85dff459c63 SHA512 1e9ae2e0cfffd80cc7219a7f989e18987b0ecaaa6e92516f823c7f3febb8fb5c86d8d9c3d9fecb98fdda699f6d7b00660d6ca3f2fee84db60f16a76d723d0b7e
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306

diff --git a/sys-libs/glibc/glibc-2.30-r6.ebuild b/sys-libs/glibc/glibc-2.30-r6.ebuild
index 2740fe7453b..45338dc43dd 100644
--- a/sys-libs/glibc/glibc-2.30-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r6.ebuild
@@ -28,7 +28,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=7
+PATCH_VER=8
 PATCH_DEV=dilfridge
 
 SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
@@ -129,6 +129,26 @@ else
 	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
 fi
 
+# Ignore tests whitelisted below
+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=(
+	# 1) Sandbox
+	tst-ldconfig-bad-aux-cache
+	tst-pldd
+	tst-mallocfork2
+	tst-nss-db-endgrent
+	tst-nss-db-endpwent
+	tst-nss-files-hosts-long
+	tst-nss-test3
+	# 2) Namespaces and cgroup
+	tst-locale-locpath
+	# 9) Failures of unknown origin
+	tst-latepthread
+)
+
 #
 # Small helper functions
 #
@@ -1138,7 +1158,15 @@ src_compile() {
 
 glibc_src_test() {
 	cd "$(builddir nptl)"
-	emake check
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	emake ${myxfailparams} check
 }
 
 do_src_test() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-22 10:39 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-03-22 10:39 UTC (permalink / raw
  To: gentoo-commits

commit:     f73508666740b15ebccfa01e79778d64406a5642
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 22 10:38:37 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Mar 22 10:39:23 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f7350866

sys-libs/glibc: Disable sandbox in test phase, it breaks too much

Acked by Sergei (slyfox)

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index fc5b12bfb5e..a2c3812e254 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -135,15 +135,7 @@ 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=(
-	# 1) Sandbox
-	tst-ldconfig-bad-aux-cache
-	tst-pldd
-	tst-mallocfork2
-	tst-nss-db-endgrent
-	tst-nss-db-endpwent
-	tst-nss-files-hosts-long
-	tst-nss-test3
-	# 2) Namespaces and cgroup
+	# 1) Namespaces and cgroup
 	tst-locale-locpath
 	# 9) Failures of unknown origin
 	tst-latepthread
@@ -1167,14 +1159,10 @@ glibc_src_test() {
 		done
 	fi
 
-	# disable tests:
-	# - tests-container:
-	#     sandbox does not understand unshare() and prevents
-	#     writes to /proc/
-	# emake ${myxfailparams} check tests-container=
-	# if possible let's list them (unless it's *all* container tests)
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
 
-	emake ${myxfailparams} check
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
 }
 
 do_src_test() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-22 10:39 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-03-22 10:39 UTC (permalink / raw
  To: gentoo-commits

commit:     8ded2e75400a506858540110fb837b1777f01d2c
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 22 10:02:40 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Mar 22 10:39:20 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8ded2e75

sys-libs/glibc: add XFAIL mechanism to 9999

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 7af2bc9cf75..fc5b12bfb5e 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -129,6 +129,26 @@ else
 	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
 fi
 
+# Ignore tests whitelisted below
+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=(
+	# 1) Sandbox
+	tst-ldconfig-bad-aux-cache
+	tst-pldd
+	tst-mallocfork2
+	tst-nss-db-endgrent
+	tst-nss-db-endpwent
+	tst-nss-files-hosts-long
+	tst-nss-test3
+	# 2) Namespaces and cgroup
+	tst-locale-locpath
+	# 9) Failures of unknown origin
+	tst-latepthread
+)
+
 #
 # Small helper functions
 #
@@ -1139,11 +1159,22 @@ src_compile() {
 
 glibc_src_test() {
 	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
 	# disable tests:
 	# - tests-container:
 	#     sandbox does not understand unshare() and prevents
 	#     writes to /proc/
-	emake check tests-container=
+	# emake ${myxfailparams} check tests-container=
+	# if possible let's list them (unless it's *all* container tests)
+
+	emake ${myxfailparams} check
 }
 
 do_src_test() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-22 14:54 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-03-22 14:54 UTC (permalink / raw
  To: gentoo-commits

commit:     51a24aa6bb6c49cc74adccc08546e32cf0c04a2b
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 22 14:53:59 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Mar 22 14:54:15 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=51a24aa6

sys-libs/glibc: 2.31 patchset bump

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.31-r2.ebuild | 1520 +++++++++++++++++++++++++++++++++++
 2 files changed, 1521 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index bbdde0350f7..24307bd28e7 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,5 +18,6 @@ DIST glibc-2.30-patches-6.tar.xz 66612 BLAKE2B 21ce2de45c1bd847ddf0e4e848e0d7adc
 DIST glibc-2.30-patches-8.tar.xz 71432 BLAKE2B 149ea765ca1aceafc3237db7362766503a0a1e5c59e82781023bf3da59690502997acebbbeca8712c8c19070951268321affe929d8777b5f3ab3e4f01bb6375f SHA512 6e953a21f858edabe03713951f7b9435d0329ad652b70836911f6a3dc8d49661f03d8f98315ded127af8be315c5ba928a94bc54cfdf37d48a5f9d1e7f9b4f92e
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-2.tar.xz 23736 BLAKE2B 181ba7f774e2964efdbe6f9f0540c27e18afe76854efcad3be5e5c277cf2e671d0f21752d1d42cb82f1e60a58f76f89a4997c12b74585f88ecbab85dff459c63 SHA512 1e9ae2e0cfffd80cc7219a7f989e18987b0ecaaa6e92516f823c7f3febb8fb5c86d8d9c3d9fecb98fdda699f6d7b00660d6ca3f2fee84db60f16a76d723d0b7e
+DIST glibc-2.31-patches-3.tar.xz 35652 BLAKE2B aca41fce54d50f09013963a54b44331a6e6ad3a8e62e51b210346a3375b7af7680c990e4824bf125597e6f53c13a3cfd81fe7727b73f7959b30b75e234751719 SHA512 b9bcf136cc2424aea21eb6497baffeca31b80b09373b770ce62dc2ce81f1c20b094fb5e2ada3afeff22785acf99e3e008ef7aa3af1068a6e53e2bccbc8dbd470
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-9999-patches-16.tar.xz 17736 BLAKE2B 772f5012ead8e27f5cf5fd2613de9a76ead2128ecd9324cc499e677ea3a96110cb0d4b1d3f12860ffa1267093db310503d7d873fb95060b0c1e046c6a60601d0 SHA512 eb885b7743ac88df7e9eb3a1cd415bc9eabff1c6bd00d32c4e50f1d9dfcc32419eb72ef06749b279d5b80a200a83bc951a851b8c96a023ab09a8a0c28045d563

diff --git a/sys-libs/glibc/glibc-2.31-r2.ebuild b/sys-libs/glibc/glibc-2.31-r2.ebuild
new file mode 100644
index 00000000000..6007469b594
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.31-r2.ebuild
@@ -0,0 +1,1520 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	# needs minimal testing
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=3
+PATCH_DEV=dilfridge
+
+SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+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"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-devel/bison-2.7
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.0.5
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 1) Namespaces and cgroup
+	tst-locale-locpath
+	# 9) Failures of unknown origin
+	tst-latepthread
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparc64v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparc64v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
+					;;
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if ver_test -ge 2.8 ; then
+						cpu="sparcv9v2"
+					elif ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if ver_test -ge 2.4 ; then
+						cpu="sparcv9v"
+					elif ver_test -ge 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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_OPT:-${CTARGET}})}
+	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ -n ${ROOT} ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-22 17:48 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-03-22 17:48 UTC (permalink / raw
  To: gentoo-commits

commit:     bd108d217527c64e8c5a553394fc80e2d10979c0
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 22 17:47:29 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Mar 22 17:48:04 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bd108d21

sys-libs/glibc: Require up-to-date libidn2

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r6.ebuild | 4 ++--
 sys-libs/glibc/glibc-2.31-r2.ebuild | 4 ++--
 sys-libs/glibc/glibc-9999.ebuild    | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30-r6.ebuild b/sys-libs/glibc/glibc-2.30-r6.ebuild
index 45338dc43dd..5b0ea0c9dc1 100644
--- a/sys-libs/glibc/glibc-2.30-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r6.ebuild
@@ -102,7 +102,7 @@ COMMON_DEPEND="
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.0.5 )
+	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
@@ -123,7 +123,7 @@ else
 	"
 	DEPEND+=" virtual/os-headers "
 	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
+		>=net-dns/libidn2-2.3.0
 		vanilla? ( !sys-libs/timezone-data )
 	"
 	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"

diff --git a/sys-libs/glibc/glibc-2.31-r2.ebuild b/sys-libs/glibc/glibc-2.31-r2.ebuild
index 6007469b594..d26cb6bd749 100644
--- a/sys-libs/glibc/glibc-2.31-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r2.ebuild
@@ -103,7 +103,7 @@ COMMON_DEPEND="
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.0.5 )
+	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
@@ -124,7 +124,7 @@ else
 	"
 	DEPEND+=" virtual/os-headers "
 	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
+		>=net-dns/libidn2-2.3.0
 		vanilla? ( !sys-libs/timezone-data )
 	"
 	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a2c3812e254..2df006b8081 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -102,7 +102,7 @@ COMMON_DEPEND="
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.0.5 )
+	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
 	sys-apps/gentoo-functions
@@ -123,7 +123,7 @@ else
 	"
 	DEPEND+=" virtual/os-headers "
 	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
+		>=net-dns/libidn2-2.3.0
 		vanilla? ( !sys-libs/timezone-data )
 	"
 	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-22 19:43 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-03-22 19:43 UTC (permalink / raw
  To: gentoo-commits

commit:     3fa01d7a01799538e253b622d755d024ea966bd9
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 22 19:43:07 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Mar 22 19:43:22 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3fa01d7a

sys-libs/glibc: Update test whitelist

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r2.ebuild | 2 --
 sys-libs/glibc/glibc-9999.ebuild    | 2 --
 2 files changed, 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.31-r2.ebuild b/sys-libs/glibc/glibc-2.31-r2.ebuild
index d26cb6bd749..15ee5c7051c 100644
--- a/sys-libs/glibc/glibc-2.31-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r2.ebuild
@@ -136,8 +136,6 @@ 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=(
-	# 1) Namespaces and cgroup
-	tst-locale-locpath
 	# 9) Failures of unknown origin
 	tst-latepthread
 )

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2df006b8081..a8207576779 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -135,8 +135,6 @@ 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=(
-	# 1) Namespaces and cgroup
-	tst-locale-locpath
 	# 9) Failures of unknown origin
 	tst-latepthread
 )


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-23 21:11 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-03-23 21:11 UTC (permalink / raw
  To: gentoo-commits

commit:     0622c241a286cd05a022854947bd3f765f8749b2
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 23 21:11:24 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Mar 23 21:11:37 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0622c241

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 -
 sys-libs/glibc/glibc-2.30-r5.ebuild | 1489 ----------------------------------
 sys-libs/glibc/glibc-2.31-r1.ebuild | 1501 -----------------------------------
 3 files changed, 2992 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 24307bd28e7..b3bf627cd44 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,10 +14,8 @@ DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 4ab583be712994f949dee2512da6e12fd
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-2.29-patches-8.tar.xz 102712 BLAKE2B 49aacff358c0f8499c444e73eec92f402b81236d6a91d1fc9864f974c5cb72fc5c87bf5ee77700a8333db4c68892b3940948158530cea0d0fbbda51df0ae7953 SHA512 7a929e023294e6b76569120cc234bc862f3e260994e56c3a2fc2b969b7313c94a47de7ef85f4e93c9083c16fde987ca470ab9d69d881ab49a22f5fd3a721703a
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
-DIST glibc-2.30-patches-6.tar.xz 66612 BLAKE2B 21ce2de45c1bd847ddf0e4e848e0d7adccc77eb91d452b9a81404b46c44ae681f31f8f41c156a782ec9390cf0d5f4d741f6a393ff6dca65b8091f126c1a30623 SHA512 0871ae71a67b21339055ac05dcb634f3b705ae44c10e7ac51e19f15196232349ed9b79a856c5e9f681dd44f9b946bbbfe170e9195819e76d0ca95dba7cede71b
 DIST glibc-2.30-patches-8.tar.xz 71432 BLAKE2B 149ea765ca1aceafc3237db7362766503a0a1e5c59e82781023bf3da59690502997acebbbeca8712c8c19070951268321affe929d8777b5f3ab3e4f01bb6375f SHA512 6e953a21f858edabe03713951f7b9435d0329ad652b70836911f6a3dc8d49661f03d8f98315ded127af8be315c5ba928a94bc54cfdf37d48a5f9d1e7f9b4f92e
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
-DIST glibc-2.31-patches-2.tar.xz 23736 BLAKE2B 181ba7f774e2964efdbe6f9f0540c27e18afe76854efcad3be5e5c277cf2e671d0f21752d1d42cb82f1e60a58f76f89a4997c12b74585f88ecbab85dff459c63 SHA512 1e9ae2e0cfffd80cc7219a7f989e18987b0ecaaa6e92516f823c7f3febb8fb5c86d8d9c3d9fecb98fdda699f6d7b00660d6ca3f2fee84db60f16a76d723d0b7e
 DIST glibc-2.31-patches-3.tar.xz 35652 BLAKE2B aca41fce54d50f09013963a54b44331a6e6ad3a8e62e51b210346a3375b7af7680c990e4824bf125597e6f53c13a3cfd81fe7727b73f7959b30b75e234751719 SHA512 b9bcf136cc2424aea21eb6497baffeca31b80b09373b770ce62dc2ce81f1c20b094fb5e2ada3afeff22785acf99e3e008ef7aa3af1068a6e53e2bccbc8dbd470
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-9999-patches-16.tar.xz 17736 BLAKE2B 772f5012ead8e27f5cf5fd2613de9a76ead2128ecd9324cc499e677ea3a96110cb0d4b1d3f12860ffa1267093db310503d7d873fb95060b0c1e046c6a60601d0 SHA512 eb885b7743ac88df7e9eb3a1cd415bc9eabff1c6bd00d32c4e50f1d9dfcc32419eb72ef06749b279d5b80a200a83bc951a851b8c96a023ab09a8a0c28045d563

diff --git a/sys-libs/glibc/glibc-2.30-r5.ebuild b/sys-libs/glibc/glibc-2.30-r5.ebuild
deleted file mode 100644
index b9770042b98..00000000000
--- a/sys-libs/glibc/glibc-2.30-r5.ebuild
+++ /dev/null
@@ -1,1489 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7,8} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=6
-PATCH_DEV=dilfridge
-
-SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-devel/bison-2.7
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ -n ${ROOT} ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all no) )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.31-r1.ebuild b/sys-libs/glibc/glibc-2.31-r1.ebuild
deleted file mode 100644
index 54758a65602..00000000000
--- a/sys-libs/glibc/glibc-2.31-r1.ebuild
+++ /dev/null
@@ -1,1501 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7,8} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	# needs minimal testing
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=2
-PATCH_DEV=slyfox
-
-SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-devel/bison-2.7
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ -n ${ROOT} ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	# disable tests:
-	# - tests-container:
-	#     sandbox does not understand unshare() and prevents
-	#     writes to /proc/
-	emake check tests-container=
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-26  4:37 Matt Turner
  0 siblings, 0 replies; 1076+ messages in thread
From: Matt Turner @ 2020-03-26  4:37 UTC (permalink / raw
  To: gentoo-commits

commit:     7daa03609079248a30f64366345bd728e65da38e
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 25 21:34:07 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Mar 26 04:37:30 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7daa0360

sys-libs/glibc: Drop SPARC CHOST mangling

Before "multiarch" support in glibc, picking a different CHOST would
select which optimized paths were built. Multiarch support was added in
glibc commit 3afd5a3b5556 (sparc: Add multiarch support for
memset/bzero/memcpy.) in 2010 before glibc-2.12.

Before glibc-2.30 glibc dropped support for SPARC v7 in commit
5d9b7b9fa734 (Remove 32 bit sparc v7 support) and in the process cleaned
up some configuration logic that accepted a wide variety of (now unused
CHOST values), thus causing the build to fail for us when we select a
now unknown CHOST.

Simply drop this logic, since it shouldn't be needed for any glibc since
2.11.

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r6.ebuild | 62 ++++---------------------------------
 sys-libs/glibc/glibc-2.31-r2.ebuild | 62 ++++---------------------------------
 sys-libs/glibc/glibc-9999.ebuild    | 62 ++++---------------------------------
 3 files changed, 18 insertions(+), 168 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30-r6.ebuild b/sys-libs/glibc/glibc-2.30-r6.ebuild
index 5b0ea0c9dc1..a2c6434e559 100644
--- a/sys-libs/glibc/glibc-2.30-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r6.ebuild
@@ -301,77 +301,27 @@ setup_target_flags() {
 			filter-flags "-fcall-used-g7"
 			append-flags "-fcall-used-g6"
 
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
 			local cpu
 			case ${CTARGET} in
 			sparc64-*)
+				cpu="sparc64"
 				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
+				v9)
 					# We need to force at least v9a because the base build doesn't
 					# work with just v9.
 					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					append-flags "-Wa,-xarch=v9a"
 					;;
 				esac
 				;;
 			sparc-*)
 				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
 				v8|supersparc|hypersparc|leon|leon3)
 					cpu="sparcv8"
 					;;
+				*)
+					cpu="sparcv9"
+					;;
 				esac
 			;;
 			esac

diff --git a/sys-libs/glibc/glibc-2.31-r2.ebuild b/sys-libs/glibc/glibc-2.31-r2.ebuild
index 15ee5c7051c..e180533f0fc 100644
--- a/sys-libs/glibc/glibc-2.31-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r2.ebuild
@@ -292,77 +292,27 @@ setup_target_flags() {
 			filter-flags "-fcall-used-g7"
 			append-flags "-fcall-used-g6"
 
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
 			local cpu
 			case ${CTARGET} in
 			sparc64-*)
+				cpu="sparc64"
 				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
+				v9)
 					# We need to force at least v9a because the base build doesn't
 					# work with just v9.
 					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					append-flags "-Wa,-xarch=v9a"
 					;;
 				esac
 				;;
 			sparc-*)
 				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
 				v8|supersparc|hypersparc|leon|leon3)
 					cpu="sparcv8"
 					;;
+				*)
+					cpu="sparcv9"
+					;;
 				esac
 			;;
 			esac

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a8207576779..1bc1d7e7ec8 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -291,77 +291,27 @@ setup_target_flags() {
 			filter-flags "-fcall-used-g7"
 			append-flags "-fcall-used-g6"
 
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
 			local cpu
 			case ${CTARGET} in
 			sparc64-*)
+				cpu="sparc64"
 				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
+				v9)
 					# We need to force at least v9a because the base build doesn't
 					# work with just v9.
 					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					append-flags "-Wa,-xarch=v9a"
 					;;
 				esac
 				;;
 			sparc-*)
 				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
 				v8|supersparc|hypersparc|leon|leon3)
 					cpu="sparcv8"
 					;;
+				*)
+					cpu="sparcv9"
+					;;
 				esac
 			;;
 			esac


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-03-28  0:29 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-03-28  0:29 UTC (permalink / raw
  To: gentoo-commits

commit:     3aa558e231d4721b384f4239b23b793253be2f42
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 28 00:29:16 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Mar 28 00:29:16 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3aa558e2

sys-libs/glibc: drop devpts mount checks, bug #704780

USE=-suid is a defaut for a while. The check made sense
when transition from USE=suid -> USE=-suid was happening.

Should not be needed nowadays.

The check fails in private-users containers where devpts
is mounted as a private group:

  # systemd-nspawn --private-users=65536 -D amd64-stable-glibc-2.30
  Selected user namespace base 65536 and range 65536
  amd64-stable-glibc-2.30 # fgrep pts /proc/mounts
  devpts /dev/pts devpts
    rw,nosuid,noexec,relatime,gid=65541,mode=620,ptmxmode=666 0 0

PTYs still work in that setup. I guess due to ptmxmode=666
broad permissions. Let's drop the old check and allow more
pts configurations.

Reported-by: Kai Krakow
Closes: https://bugs.gentoo.org/704780
Package-Manager: Portage-2.3.96, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r2.ebuild | 24 ------------------------
 sys-libs/glibc/glibc-9999.ebuild    | 24 ------------------------
 2 files changed, 48 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.31-r2.ebuild b/sys-libs/glibc/glibc-2.31-r2.ebuild
index e180533f0fc..a46143ef0a5 100644
--- a/sys-libs/glibc/glibc-2.31-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r2.ebuild
@@ -494,27 +494,6 @@ glibc_banner() {
 	echo "${b}"
 }
 
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ -n ${ROOT} ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
 # The following Kernel version handling functions are mostly copied from portage
 # source. It's better not to use linux-info.eclass here since a) it adds too
 # much magic, see bug 326693 for some of the arguments, and b) some of the
@@ -584,9 +563,6 @@ get_kheader_version() {
 # pkg_ and src_ phases, so we call this function both in pkg_pretend and in
 # src_unpack.
 sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
 	# Prevent native builds from downgrading
 	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
 	   [[ -z ${ROOT} ]] && \

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 1bc1d7e7ec8..38268c5f937 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -493,27 +493,6 @@ glibc_banner() {
 	echo "${b}"
 }
 
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ -n ${ROOT} ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
 # The following Kernel version handling functions are mostly copied from portage
 # source. It's better not to use linux-info.eclass here since a) it adds too
 # much magic, see bug 326693 for some of the arguments, and b) some of the
@@ -583,9 +562,6 @@ get_kheader_version() {
 # pkg_ and src_ phases, so we call this function both in pkg_pretend and in
 # src_unpack.
 sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
 	# Prevent native builds from downgrading
 	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
 	   [[ -z ${ROOT} ]] && \


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-01 17:32 Matt Turner
  0 siblings, 0 replies; 1076+ messages in thread
From: Matt Turner @ 2020-04-01 17:32 UTC (permalink / raw
  To: gentoo-commits

commit:     f13d3a1eddd7c045dea5cc95e170f2f21c0a2c0e
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 25 21:34:07 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Wed Apr  1 17:32:25 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f13d3a1e

sys-libs/glibc: Drop SPARC CHOST mangling

Somehow glibc-2.29 is also affected, even though it used to work. See
commit 7daa03609079 for the changes to later versions.

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r7.ebuild | 62 ++++---------------------------------
 1 file changed, 6 insertions(+), 56 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
index b883c878e01..1ffe9800d1d 100644
--- a/sys-libs/glibc/glibc-2.29-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild
@@ -281,77 +281,27 @@ setup_target_flags() {
 			filter-flags "-fcall-used-g7"
 			append-flags "-fcall-used-g6"
 
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
 			local cpu
 			case ${CTARGET} in
 			sparc64-*)
+				cpu="sparc64"
 				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
+				v9)
 					# We need to force at least v9a because the base build doesn't
 					# work with just v9.
 					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
+					append-flags "-Wa,-xarch=v9a"
 					;;
 				esac
 				;;
 			sparc-*)
 				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
 				v8|supersparc|hypersparc|leon|leon3)
 					cpu="sparcv8"
 					;;
+				*)
+					cpu="sparcv9"
+					;;
 				esac
 			;;
 			esac


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-02  7:03 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-04-02  7:03 UTC (permalink / raw
  To: gentoo-commits

commit:     09dbbf679f35d0cce0b1f453e5a4efbcb99872bb
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Apr  2 07:01:38 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Apr  2 07:03:31 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=09dbbf67

sys-libs/glibc: set correct cross-CC for sparc32

Commit "sys-libs/glibc: Drop SPARC CHOST mangling"
exposed a old bug where we were setting CC=${CTARGET_OPT}.

But we don't have ${CTARGET_OPT}-gcc or anything else
and thus fallback to 'gcc' happens.

Always use CC=${CTARGET}.

Package-Manager: Portage-2.3.96, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r7.ebuild | 2 +-
 sys-libs/glibc/glibc-2.30-r6.ebuild | 2 +-
 sys-libs/glibc/glibc-2.31-r2.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
index 1ffe9800d1d..6492f3e4bee 100644
--- a/sys-libs/glibc/glibc-2.29-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild
@@ -446,7 +446,7 @@ setup_env() {
 	# 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_OPT:-${CTARGET}})}
+	: ${__GLIBC_CC:=$(tc-getCC ${CTARGET})}
 	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
 	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
 }

diff --git a/sys-libs/glibc/glibc-2.30-r6.ebuild b/sys-libs/glibc/glibc-2.30-r6.ebuild
index 00846478a13..779353d0f84 100644
--- a/sys-libs/glibc/glibc-2.30-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r6.ebuild
@@ -472,7 +472,7 @@ setup_env() {
 	# 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_OPT:-${CTARGET}})}
+	: ${__GLIBC_CC:=$(tc-getCC ${CTARGET})}
 	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
 	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
 }

diff --git a/sys-libs/glibc/glibc-2.31-r2.ebuild b/sys-libs/glibc/glibc-2.31-r2.ebuild
index a46143ef0a5..db866fbf1a2 100644
--- a/sys-libs/glibc/glibc-2.31-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r2.ebuild
@@ -463,7 +463,7 @@ setup_env() {
 	# 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_OPT:-${CTARGET}})}
+	: ${__GLIBC_CC:=$(tc-getCC ${CTARGET})}
 	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
 	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
 }

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 38268c5f937..ca721953558 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -462,7 +462,7 @@ setup_env() {
 	# 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_OPT:-${CTARGET}})}
+	: ${__GLIBC_CC:=$(tc-getCC ${CTARGET})}
 	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
 	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-03 22:29 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-04-03 22:29 UTC (permalink / raw
  To: gentoo-commits

commit:     5c13a147971d5c5a6680b8009cb8f5f02e1d1ef9
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  3 22:29:17 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Apr  3 22:29:17 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5c13a147

sys-libs/glibc: add sparc sigreturn fix to 2.29 and 2.30

The change should fix numerous problems we see in signal
handling scenarios.

Reported-by: Rolf Eike Beer
Package-Manager: Portage-2.3.96, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 +
 sys-libs/glibc/glibc-2.29-r8.ebuild | 1427 +++++++++++++++++++++++++++++++++
 sys-libs/glibc/glibc-2.30-r7.ebuild | 1471 +++++++++++++++++++++++++++++++++++
 3 files changed, 2900 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index b3bf627cd44..61c6b74fd40 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -13,8 +13,10 @@ DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea
 DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 4ab583be712994f949dee2512da6e12fd7f7ad73e96393f21678552b43da98f49321b53b5b009551300cdb09ca135e7f6adc636ff750c251a1d6d7f262dbc410 SHA512 e3f40ae6e9d06471c1a11bd2bce7b5161d07c3d0a81791505a72aec4817e7faf9ef09841e98c6dcf62a0a00754dff87dd194d97ac6b6354aeb2497cf60900b96
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-2.29-patches-8.tar.xz 102712 BLAKE2B 49aacff358c0f8499c444e73eec92f402b81236d6a91d1fc9864f974c5cb72fc5c87bf5ee77700a8333db4c68892b3940948158530cea0d0fbbda51df0ae7953 SHA512 7a929e023294e6b76569120cc234bc862f3e260994e56c3a2fc2b969b7313c94a47de7ef85f4e93c9083c16fde987ca470ab9d69d881ab49a22f5fd3a721703a
+DIST glibc-2.29-patches-9.tar.xz 104444 BLAKE2B 3c20891ee5c435925e67bbb641da54b6b7fe0114f5f1d3ea9e616414f9bafb4d32b4303f4f798507ee4e42227d68a543da203450b9bd10b61628cd0b3547725c SHA512 c38f23e78e313fe2a9e223b720e8fd93c7c57e8408c6bc3ceacbfde354fa5d963e3cb525fe75aad7aaf7347066c0e4a671c0553fe490888478ff909492fdd164
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-8.tar.xz 71432 BLAKE2B 149ea765ca1aceafc3237db7362766503a0a1e5c59e82781023bf3da59690502997acebbbeca8712c8c19070951268321affe929d8777b5f3ab3e4f01bb6375f SHA512 6e953a21f858edabe03713951f7b9435d0329ad652b70836911f6a3dc8d49661f03d8f98315ded127af8be315c5ba928a94bc54cfdf37d48a5f9d1e7f9b4f92e
+DIST glibc-2.30-patches-9.tar.xz 73112 BLAKE2B 3156d3badafb1d44f72953a256c2325e107613557d28c5b257e6dbf55f233efa3ca5fe6a742751a86f14aa5b4e541d0870c0e0a7659a4414c80cd5404a76bb80 SHA512 fad2f8ac9bc3557b69365b5f168aa99834d8a00f69aab81232009893722274ffa73e0baa0a0ff95a77551575f89a1cb2a7e61521b68e9950aa079c5eae586a04
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-3.tar.xz 35652 BLAKE2B aca41fce54d50f09013963a54b44331a6e6ad3a8e62e51b210346a3375b7af7680c990e4824bf125597e6f53c13a3cfd81fe7727b73f7959b30b75e234751719 SHA512 b9bcf136cc2424aea21eb6497baffeca31b80b09373b770ce62dc2ce81f1c20b094fb5e2ada3afeff22785acf99e3e008ef7aa3af1068a6e53e2bccbc8dbd470
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306

diff --git a/sys-libs/glibc/glibc-2.29-r8.ebuild b/sys-libs/glibc/glibc-2.29-r8.ebuild
new file mode 100644
index 00000000000..c869cce61d5
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.29-r8.ebuild
@@ -0,0 +1,1427 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=9
+PATCH_DEV=slyfox
+
+SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-devel/bison-2.7
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.0.5 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.0.5
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake -s glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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' 2>/dev/null ; then
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		amd64)
+			# -march needed for #185404 #199334
+			# Note: This test only matters when the x86 ABI is enabled, so we could
+			# optimize a bit and elide it.
+			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Over-zealous CFLAGS can often cause problems.  What may work for one
+	# person may not work for another.  To avoid a large influx of bugs
+	# relating to failed builds, we strip most CFLAGS out to ensure as few
+	# problems as possible.
+	strip-flags
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# Lock glibc at -O2; we want to be conservative here.
+	# -fno-strict-aliasing is to work around #155906.
+	filter-flags '-O?'
+	append-flags -O2 -fno-strict-aliasing
+
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ -n ${ROOT} ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
+		*)
+			myconf+=( --enable-stack-protector=$(usex ssp all no) )
+			;;
+	esac
+	myconf+=( --enable-stackguard-randomization )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+	emake check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}

diff --git a/sys-libs/glibc/glibc-2.30-r7.ebuild b/sys-libs/glibc/glibc-2.30-r7.ebuild
new file mode 100644
index 00000000000..58f64e8203c
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.30-r7.ebuild
@@ -0,0 +1,1471 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=9
+PATCH_DEV=slyfox
+
+SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-devel/bison-2.7
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 1) Sandbox
+	tst-ldconfig-bad-aux-cache
+	tst-pldd
+	tst-mallocfork2
+	tst-nss-db-endgrent
+	tst-nss-db-endpwent
+	tst-nss-files-hosts-long
+	tst-nss-test3
+	# 2) Namespaces and cgroup
+	tst-locale-locpath
+	# 9) Failures of unknown origin
+	tst-latepthread
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ -n ${ROOT} ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-03 22:37 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-04-03 22:37 UTC (permalink / raw
  To: gentoo-commits

commit:     93ceed55cd26146919435836599a90e17a5dddba
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  3 22:37:33 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Apr  3 22:37:33 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=93ceed55

sys-libs/glibc: switch -fstack-protector-all to -strong, bug #712356

Package-Manager: Portage-2.3.96, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r8.ebuild | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r8.ebuild b/sys-libs/glibc/glibc-2.29-r8.ebuild
index c869cce61d5..c95d7016c40 100644
--- a/sys-libs/glibc/glibc-2.29-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r8.ebuild
@@ -812,7 +812,11 @@ glibc_do_configure() {
 			myconf+=( --enable-stack-protector=no )
 			;;
 		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all 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 )


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-10 16:06 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-04-10 16:06 UTC (permalink / raw
  To: gentoo-commits

commit:     6beb913ef3cbef311a154ac189b610376b3f62eb
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 10 16:04:42 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Apr 10 16:06:08 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6beb913e

sys-libs/glibc: 2.30 revision bump, patchlevel 10

Add i386-specific fix for -fno-omit-frame-pointer (glibc bug 25788)

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.30-r8.ebuild | 1471 +++++++++++++++++++++++++++++++++++
 2 files changed, 1472 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 61c6b74fd40..56f8e9e64c5 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,6 +15,7 @@ DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79
 DIST glibc-2.29-patches-8.tar.xz 102712 BLAKE2B 49aacff358c0f8499c444e73eec92f402b81236d6a91d1fc9864f974c5cb72fc5c87bf5ee77700a8333db4c68892b3940948158530cea0d0fbbda51df0ae7953 SHA512 7a929e023294e6b76569120cc234bc862f3e260994e56c3a2fc2b969b7313c94a47de7ef85f4e93c9083c16fde987ca470ab9d69d881ab49a22f5fd3a721703a
 DIST glibc-2.29-patches-9.tar.xz 104444 BLAKE2B 3c20891ee5c435925e67bbb641da54b6b7fe0114f5f1d3ea9e616414f9bafb4d32b4303f4f798507ee4e42227d68a543da203450b9bd10b61628cd0b3547725c SHA512 c38f23e78e313fe2a9e223b720e8fd93c7c57e8408c6bc3ceacbfde354fa5d963e3cb525fe75aad7aaf7347066c0e4a671c0553fe490888478ff909492fdd164
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
+DIST glibc-2.30-patches-10.tar.xz 72808 BLAKE2B a7a95c99482524b2896d15539766f1e6b1fe34a22f32119248c6dd44f42632076e86fdcbbdc2d604ec73ceccdd8a7f5936a62a6f4c3d039fae8f6901dfc6be77 SHA512 af5e213ff08bf38f6f529816c36b4e38df27207c2df254609ebe45b2f039ab553bbe563aa6f64b6667d328fd2c120dc21b6e2676540bdd94e58079237089eac3
 DIST glibc-2.30-patches-8.tar.xz 71432 BLAKE2B 149ea765ca1aceafc3237db7362766503a0a1e5c59e82781023bf3da59690502997acebbbeca8712c8c19070951268321affe929d8777b5f3ab3e4f01bb6375f SHA512 6e953a21f858edabe03713951f7b9435d0329ad652b70836911f6a3dc8d49661f03d8f98315ded127af8be315c5ba928a94bc54cfdf37d48a5f9d1e7f9b4f92e
 DIST glibc-2.30-patches-9.tar.xz 73112 BLAKE2B 3156d3badafb1d44f72953a256c2325e107613557d28c5b257e6dbf55f233efa3ca5fe6a742751a86f14aa5b4e541d0870c0e0a7659a4414c80cd5404a76bb80 SHA512 fad2f8ac9bc3557b69365b5f168aa99834d8a00f69aab81232009893722274ffa73e0baa0a0ff95a77551575f89a1cb2a7e61521b68e9950aa079c5eae586a04
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
new file mode 100644
index 00000000000..ca3472965c1
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -0,0 +1,1471 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=10
+PATCH_DEV=dilfridge
+
+SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-devel/bison-2.7
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 1) Sandbox
+	tst-ldconfig-bad-aux-cache
+	tst-pldd
+	tst-mallocfork2
+	tst-nss-db-endgrent
+	tst-nss-db-endpwent
+	tst-nss-files-hosts-long
+	tst-nss-test3
+	# 2) Namespaces and cgroup
+	tst-locale-locpath
+	# 9) Failures of unknown origin
+	tst-latepthread
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+check_devpts() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+	# If merely building the binary package, then there's nothing to verify.
+	[[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+	# Only sanity check when installing the native glibc.
+	[[ -n ${ROOT} ]] && return
+
+	# If they're opting in to the old suid code, then no need to check.
+	use suid && return
+
+	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+		eerror "In order to use glibc with USE=-suid, you must make sure that"
+		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+		eerror "Openrc should do this for you, so you should check /etc/fstab"
+		eerror "and make sure you do not have any invalid settings there."
+		die "mount & fix your /dev/pts settings"
+	fi
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
+	check_devpts
+
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-10 16:06 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-04-10 16:06 UTC (permalink / raw
  To: gentoo-commits

commit:     01a235c3ef0abfb2a5f92630ea6f0599ba320af5
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 10 16:05:21 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Apr 10 16:06:11 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=01a235c3

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.30-r6.ebuild | 1471 -----------------------------------
 2 files changed, 1472 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 56f8e9e64c5..67a285700ae 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,7 +16,6 @@ DIST glibc-2.29-patches-8.tar.xz 102712 BLAKE2B 49aacff358c0f8499c444e73eec92f40
 DIST glibc-2.29-patches-9.tar.xz 104444 BLAKE2B 3c20891ee5c435925e67bbb641da54b6b7fe0114f5f1d3ea9e616414f9bafb4d32b4303f4f798507ee4e42227d68a543da203450b9bd10b61628cd0b3547725c SHA512 c38f23e78e313fe2a9e223b720e8fd93c7c57e8408c6bc3ceacbfde354fa5d963e3cb525fe75aad7aaf7347066c0e4a671c0553fe490888478ff909492fdd164
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-10.tar.xz 72808 BLAKE2B a7a95c99482524b2896d15539766f1e6b1fe34a22f32119248c6dd44f42632076e86fdcbbdc2d604ec73ceccdd8a7f5936a62a6f4c3d039fae8f6901dfc6be77 SHA512 af5e213ff08bf38f6f529816c36b4e38df27207c2df254609ebe45b2f039ab553bbe563aa6f64b6667d328fd2c120dc21b6e2676540bdd94e58079237089eac3
-DIST glibc-2.30-patches-8.tar.xz 71432 BLAKE2B 149ea765ca1aceafc3237db7362766503a0a1e5c59e82781023bf3da59690502997acebbbeca8712c8c19070951268321affe929d8777b5f3ab3e4f01bb6375f SHA512 6e953a21f858edabe03713951f7b9435d0329ad652b70836911f6a3dc8d49661f03d8f98315ded127af8be315c5ba928a94bc54cfdf37d48a5f9d1e7f9b4f92e
 DIST glibc-2.30-patches-9.tar.xz 73112 BLAKE2B 3156d3badafb1d44f72953a256c2325e107613557d28c5b257e6dbf55f233efa3ca5fe6a742751a86f14aa5b4e541d0870c0e0a7659a4414c80cd5404a76bb80 SHA512 fad2f8ac9bc3557b69365b5f168aa99834d8a00f69aab81232009893722274ffa73e0baa0a0ff95a77551575f89a1cb2a7e61521b68e9950aa079c5eae586a04
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-3.tar.xz 35652 BLAKE2B aca41fce54d50f09013963a54b44331a6e6ad3a8e62e51b210346a3375b7af7680c990e4824bf125597e6f53c13a3cfd81fe7727b73f7959b30b75e234751719 SHA512 b9bcf136cc2424aea21eb6497baffeca31b80b09373b770ce62dc2ce81f1c20b094fb5e2ada3afeff22785acf99e3e008ef7aa3af1068a6e53e2bccbc8dbd470

diff --git a/sys-libs/glibc/glibc-2.30-r6.ebuild b/sys-libs/glibc/glibc-2.30-r6.ebuild
deleted file mode 100644
index 779353d0f84..00000000000
--- a/sys-libs/glibc/glibc-2.30-r6.ebuild
+++ /dev/null
@@ -1,1471 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7,8} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=8
-PATCH_DEV=dilfridge
-
-SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-devel/bison-2.7
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 1) Sandbox
-	tst-ldconfig-bad-aux-cache
-	tst-pldd
-	tst-mallocfork2
-	tst-nss-db-endgrent
-	tst-nss-db-endpwent
-	tst-nss-files-hosts-long
-	tst-nss-test3
-	# 2) Namespaces and cgroup
-	tst-locale-locpath
-	# 9) Failures of unknown origin
-	tst-latepthread
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ -n ${ROOT} ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-13 17:25 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-04-13 17:25 UTC (permalink / raw
  To: gentoo-commits

commit:     f9af1617f1aadafb91a9afc9428000b5be7f10e9
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 13 17:25:12 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Apr 13 17:25:43 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f9af1617

sys-libs/glibc: 2.31 patchlevel update (tip of release branch)

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             | 2 +-
 sys-libs/glibc/glibc-2.31-r2.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 67a285700ae..4959cb8996a 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,6 +18,6 @@ DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc
 DIST glibc-2.30-patches-10.tar.xz 72808 BLAKE2B a7a95c99482524b2896d15539766f1e6b1fe34a22f32119248c6dd44f42632076e86fdcbbdc2d604ec73ceccdd8a7f5936a62a6f4c3d039fae8f6901dfc6be77 SHA512 af5e213ff08bf38f6f529816c36b4e38df27207c2df254609ebe45b2f039ab553bbe563aa6f64b6667d328fd2c120dc21b6e2676540bdd94e58079237089eac3
 DIST glibc-2.30-patches-9.tar.xz 73112 BLAKE2B 3156d3badafb1d44f72953a256c2325e107613557d28c5b257e6dbf55f233efa3ca5fe6a742751a86f14aa5b4e541d0870c0e0a7659a4414c80cd5404a76bb80 SHA512 fad2f8ac9bc3557b69365b5f168aa99834d8a00f69aab81232009893722274ffa73e0baa0a0ff95a77551575f89a1cb2a7e61521b68e9950aa079c5eae586a04
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
-DIST glibc-2.31-patches-3.tar.xz 35652 BLAKE2B aca41fce54d50f09013963a54b44331a6e6ad3a8e62e51b210346a3375b7af7680c990e4824bf125597e6f53c13a3cfd81fe7727b73f7959b30b75e234751719 SHA512 b9bcf136cc2424aea21eb6497baffeca31b80b09373b770ce62dc2ce81f1c20b094fb5e2ada3afeff22785acf99e3e008ef7aa3af1068a6e53e2bccbc8dbd470
+DIST glibc-2.31-patches-4.tar.xz 40464 BLAKE2B 8c79b446a37be8f33c10b9fe987d2f55f285bf672a48bf307b60cbc322aadad1eec209b8d2ab88c023fcc718b08d089a151797e2b7352672234044ccd5eb9a9d SHA512 385de24a814646af3c8504ac1b76aa9d8ee5043d1e666656f7b31fc4a66c32b7c2a7b361b1a77e910182c07ff44bb1d228fd8de13a1915210035cad71251001a
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-9999-patches-16.tar.xz 17736 BLAKE2B 772f5012ead8e27f5cf5fd2613de9a76ead2128ecd9324cc499e677ea3a96110cb0d4b1d3f12860ffa1267093db310503d7d873fb95060b0c1e046c6a60601d0 SHA512 eb885b7743ac88df7e9eb3a1cd415bc9eabff1c6bd00d32c4e50f1d9dfcc32419eb72ef06749b279d5b80a200a83bc951a851b8c96a023ab09a8a0c28045d563

diff --git a/sys-libs/glibc/glibc-2.31-r2.ebuild b/sys-libs/glibc/glibc-2.31-r2.ebuild
index db866fbf1a2..6afa9eaa6ef 100644
--- a/sys-libs/glibc/glibc-2.31-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r2.ebuild
@@ -29,7 +29,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=3
+PATCH_VER=4
 PATCH_DEV=dilfridge
 
 SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-23  7:45 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-04-23  7:45 UTC (permalink / raw
  To: gentoo-commits

commit:     f751aee6d46ef7c7ef633a97ae0e50c64b075e38
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 23 07:40:18 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Apr 23 07:45:08 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f751aee6

sys-libs/glibc: remove old

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.30-r7.ebuild | 1471 -----------------------------------
 2 files changed, 1472 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 4959cb8996a..e0f13392aae 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,7 +16,6 @@ DIST glibc-2.29-patches-8.tar.xz 102712 BLAKE2B 49aacff358c0f8499c444e73eec92f40
 DIST glibc-2.29-patches-9.tar.xz 104444 BLAKE2B 3c20891ee5c435925e67bbb641da54b6b7fe0114f5f1d3ea9e616414f9bafb4d32b4303f4f798507ee4e42227d68a543da203450b9bd10b61628cd0b3547725c SHA512 c38f23e78e313fe2a9e223b720e8fd93c7c57e8408c6bc3ceacbfde354fa5d963e3cb525fe75aad7aaf7347066c0e4a671c0553fe490888478ff909492fdd164
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-10.tar.xz 72808 BLAKE2B a7a95c99482524b2896d15539766f1e6b1fe34a22f32119248c6dd44f42632076e86fdcbbdc2d604ec73ceccdd8a7f5936a62a6f4c3d039fae8f6901dfc6be77 SHA512 af5e213ff08bf38f6f529816c36b4e38df27207c2df254609ebe45b2f039ab553bbe563aa6f64b6667d328fd2c120dc21b6e2676540bdd94e58079237089eac3
-DIST glibc-2.30-patches-9.tar.xz 73112 BLAKE2B 3156d3badafb1d44f72953a256c2325e107613557d28c5b257e6dbf55f233efa3ca5fe6a742751a86f14aa5b4e541d0870c0e0a7659a4414c80cd5404a76bb80 SHA512 fad2f8ac9bc3557b69365b5f168aa99834d8a00f69aab81232009893722274ffa73e0baa0a0ff95a77551575f89a1cb2a7e61521b68e9950aa079c5eae586a04
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-4.tar.xz 40464 BLAKE2B 8c79b446a37be8f33c10b9fe987d2f55f285bf672a48bf307b60cbc322aadad1eec209b8d2ab88c023fcc718b08d089a151797e2b7352672234044ccd5eb9a9d SHA512 385de24a814646af3c8504ac1b76aa9d8ee5043d1e666656f7b31fc4a66c32b7c2a7b361b1a77e910182c07ff44bb1d228fd8de13a1915210035cad71251001a
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306

diff --git a/sys-libs/glibc/glibc-2.30-r7.ebuild b/sys-libs/glibc/glibc-2.30-r7.ebuild
deleted file mode 100644
index 58f64e8203c..00000000000
--- a/sys-libs/glibc/glibc-2.30-r7.ebuild
+++ /dev/null
@@ -1,1471 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7,8} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=9
-PATCH_DEV=slyfox
-
-SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-devel/bison-2.7
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 1) Sandbox
-	tst-ldconfig-bad-aux-cache
-	tst-pldd
-	tst-mallocfork2
-	tst-nss-db-endgrent
-	tst-nss-db-endpwent
-	tst-nss-files-hosts-long
-	tst-nss-test3
-	# 2) Namespaces and cgroup
-	tst-locale-locpath
-	# 9) Failures of unknown origin
-	tst-latepthread
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ -n ${ROOT} ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-23  9:02 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2020-04-23  9:02 UTC (permalink / raw
  To: gentoo-commits

commit:     ae2c9e61da9004a1c67f47d133f393822f7d0659
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 23 09:01:44 2020 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Thu Apr 23 09:01:44 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ae2c9e61

sys-libs/glibc: amd64 stable wrt bug #712726

Package-Manager: Portage-2.3.89, Repoman-2.3.20
RepoMan-Options: --include-arches="amd64"
Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r8.ebuild | 2 +-
 sys-libs/glibc/glibc-2.30-r8.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.29-r8.ebuild b/sys-libs/glibc/glibc-2.29-r8.ebuild
index c95d7016c40..90929cb8eb9 100644
--- a/sys-libs/glibc/glibc-2.29-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
index ca3472965c1..402b3ccc23c 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-23 19:33 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-04-23 19:33 UTC (permalink / raw
  To: gentoo-commits

commit:     71cfbaaa8feb9925ae64b9a689a1859d9bf14862
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 23 19:27:53 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Apr 23 19:30:54 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=71cfbaaa

sys-libs/glibc: Block too-old openssh in 2.31 and later, bug 708224

Bug: https://bugs.gentoo.org/708224
Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r2.ebuild | 3 +++
 sys-libs/glibc/glibc-9999.ebuild    | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.31-r2.ebuild b/sys-libs/glibc/glibc-2.31-r2.ebuild
index 6afa9eaa6ef..f03483a5f7c 100644
--- a/sys-libs/glibc/glibc-2.31-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r2.ebuild
@@ -85,6 +85,8 @@ fi
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,
 # and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
 BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
@@ -101,6 +103,7 @@ COMMON_DEPEND="
 	suid? ( caps? ( sys-libs/libcap ) )
 	selinux? ( sys-libs/libselinux )
 	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
 "
 DEPEND="${COMMON_DEPEND}
 	test? ( >=net-dns/libidn2-2.3.0 )

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ca721953558..dafe72da8ed 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -84,6 +84,8 @@ fi
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,
 # and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
 BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
@@ -100,6 +102,7 @@ COMMON_DEPEND="
 	suid? ( caps? ( sys-libs/libcap ) )
 	selinux? ( sys-libs/libselinux )
 	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
 "
 DEPEND="${COMMON_DEPEND}
 	test? ( >=net-dns/libidn2-2.3.0 )


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-23 20:39 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-04-23 20:39 UTC (permalink / raw
  To: gentoo-commits

commit:     65bbe6b04a7f9452a06b4fdd377032d560989118
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 23 20:38:56 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Apr 23 20:39:42 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65bbe6b0

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |   2 -
 sys-libs/glibc/glibc-2.24-r4.ebuild | 173 ------------------------------------
 2 files changed, 175 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index e0f13392aae..d7c9f2505cf 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -2,8 +2,6 @@ DIST gcc-4.7.3-r1-multilib-bootstrap.tar.bz2 8064097 BLAKE2B 3cc5c82cd57d0fbd26d
 DIST gcc-multilib-bootstrap-20180511.tar.xz 2392908 BLAKE2B f3cf614399368acd8908f60d894c6344a2fa09383b30c1633a0682bc668367c8a2f8c6fec2d41b6e2178d709a2bd8db57e8b2ab56ba263c7d56f819c15acd061 SHA512 98c766e913693ab42ff790557acde2a36a8001e2648046a685b21964200df8d4d52d8452d499c0068c6648284d086ce062c2d36e2c6c2fd8aacd232d193f2853
 DIST glibc-2.19-patches-9.tar.bz2 24584 BLAKE2B a96e930a5bd20fa75d9f259cc2117fa5ce98072274a24a5823bf877e3739fa4c001a94d7865e065ee0527f3974430d27da8038e042340a451ad2052c62724f26 SHA512 a95b3063ade974a3556480b798b317d33c7423a8cb9e69f67249ffb8b3d3c671d70d2d5f782c1efadc0bec4cc49a96d4fe89911f3dfcd85b459f69f3b4f38f0e
 DIST glibc-2.19.tar.xz 12083312 BLAKE2B 9dc03346e0f0df4bf009a92d894b0a9f964ff92b7f4c9663cedf1cb6cf90435f28a15539d33791ecf43ee578fa4e26f916af0367651312ef8f9c1c38ce0dafa2 SHA512 9e021fcb3afbb9ace2a0e37fded231a62de861bd766e29d47163a03182e37add718b7acc3963d1c525f9556773e842297725715acde48dcfbaab6e756af1a23d
-DIST glibc-2.24-patches-10.tar.bz2 73586 BLAKE2B f42cc78b907e7cb5c8ba1672c845cdc0959f4d29f89ff642bd2efa795d7ac69409b514338ac1f4235ce2fbc0c9c9bb2d152f55fd14c02997517dc048a306e1c1 SHA512 fc9191a85da53a2515bbaab228648936682e04267284049468e0c82284f618ab2907b9247baca701e16edc50640199ff6d8e2a6a93ccbd5a9d3b0eb73cc484ca
-DIST glibc-2.24.tar.xz 13554048 BLAKE2B 9f93ac00f68eb88e3a2272752624163fac25dd064170e336143aa697908fba2b27ed926582f978da99c6c2489c0ce34d3eb266b5d00be69d27b36126bc2c8efb SHA512 a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb
 DIST glibc-2.25-patches-15.tar.bz2 78320 BLAKE2B 70c62cc10db13e2844de4d8a18972e0f4d01ba52fbd40db57c11d7b1c2c0d571b894f01e762bb26632fd696a77c299ef0766e2f129d2eda896f58325a754a13c SHA512 7204218ea82b677e0f278c4752ddb90aa0c08ac2349d061de81ec91dac204b0f10fe223d7b1055b9e0c21dac97c835f913a90c0168a5000d3be00dd20027c185
 DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
 DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b217391156f897a8db50f65a69627d8f8cceded78414168986ee98eba038364a6b2f3599b23f95e7b0ad2643481c399718 SHA512 0c812a343fcc68c10d92117cb2a0cf1c255470e81f0a7a04d6db2fe35445e410ef37f15162f145c2eb772b08ab55af246f5b52f5e57c2e91038181f6f027abc3

diff --git a/sys-libs/glibc/glibc-2.24-r4.ebuild b/sys-libs/glibc/glibc-2.24-r4.ebuild
deleted file mode 100644
index 567bb161517..00000000000
--- a/sys-libs/glibc/glibc-2.24-r4.ebuild
+++ /dev/null
@@ -1,173 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit toolchain-funcs toolchain-glibc
-
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86"
-EMULTILIB_PKG="true"
-
-# Configuration variables
-RELEASE_VER=""
-case ${PV} in
-9999*)
-	EGIT_REPO_URIS="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-	;;
-*)
-	RELEASE_VER=${PV}
-	;;
-esac
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="10"                                 # Gentoo patchset
-: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
-
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla headers-only"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we disable stripping
-# entirely.
-RESTRICT=strip
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.7
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.7
-		virtual/os-headers"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
-}
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
-
-src_unpack() {
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	toolchain-glibc_src_unpack
-}
-
-src_prepare() {
-	toolchain-glibc_src_prepare
-
-	cd "${S}"
-
-	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-
-		# Build various bits with ssp-all
-		sed -i \
-			-e 's:-fstack-protector$:-fstack-protector-all:' \
-			*/Makefile || die
-	fi
-
-	case $(gcc-fullversion) in
-	4.8.[0-3]|4.9.0)
-		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
-		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
-		die "need to switch compilers #547420"
-		;;
-	esac
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-23 20:39 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-04-23 20:39 UTC (permalink / raw
  To: gentoo-commits

commit:     7f50d2e807f949ff10bf8b90d1c46d80e5392fd7
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 23 20:38:08 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Apr 23 20:39:39 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7f50d2e8

sys-libs/glibc: Restore keywords of 2.31

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.31-r2.ebuild b/sys-libs/glibc/glibc-2.31-r2.ebuild
index f03483a5f7c..2945adf1290 100644
--- a/sys-libs/glibc/glibc-2.31-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r2.ebuild
@@ -20,7 +20,7 @@ if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
 	# needs minimal testing
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-24  8:59 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2020-04-24  8:59 UTC (permalink / raw
  To: gentoo-commits

commit:     531a0b6b17e0fa249732c9c02dde397e99d9b817
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 24 08:59:23 2020 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Fri Apr 24 08:59:23 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=531a0b6b

sys-libs/glibc: arm stable wrt bug #712726

Package-Manager: Portage-2.3.89, Repoman-2.3.20
RepoMan-Options: --include-arches="arm"
Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r8.ebuild | 2 +-
 sys-libs/glibc/glibc-2.30-r8.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.29-r8.ebuild b/sys-libs/glibc/glibc-2.29-r8.ebuild
index 90929cb8eb9..90c601a7218 100644
--- a/sys-libs/glibc/glibc-2.29-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
index 402b3ccc23c..a1bdf18122e 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-24  8:59 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2020-04-24  8:59 UTC (permalink / raw
  To: gentoo-commits

commit:     cc7334ba90778a362e68d4a77087321d10cb3598
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 24 08:59:53 2020 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Fri Apr 24 08:59:54 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cc7334ba

sys-libs/glibc: s390 stable wrt bug #712726

Package-Manager: Portage-2.3.89, Repoman-2.3.20
RepoMan-Options: --include-arches="s390"
Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r8.ebuild | 2 +-
 sys-libs/glibc/glibc-2.30-r8.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.29-r8.ebuild b/sys-libs/glibc/glibc-2.29-r8.ebuild
index 90c601a7218..2e21b6bac68 100644
--- a/sys-libs/glibc/glibc-2.29-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
index a1bdf18122e..63049c94d56 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-24  9:00 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2020-04-24  9:00 UTC (permalink / raw
  To: gentoo-commits

commit:     148a5a42b7051379bb1e527d07eae3b1c8f6c443
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 24 09:00:23 2020 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Fri Apr 24 09:00:23 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=148a5a42

sys-libs/glibc: x86 stable wrt bug #712726

Package-Manager: Portage-2.3.89, Repoman-2.3.20
RepoMan-Options: --include-arches="x86"
Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r8.ebuild | 2 +-
 sys-libs/glibc/glibc-2.30-r8.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.29-r8.ebuild b/sys-libs/glibc/glibc-2.29-r8.ebuild
index 2e21b6bac68..83c66a1105c 100644
--- a/sys-libs/glibc/glibc-2.29-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
index 63049c94d56..e10c8e18e39 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-24 12:10 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2020-04-24 12:10 UTC (permalink / raw
  To: gentoo-commits

commit:     bc069e0df6ed39059b2601b0f287d5c029eafd75
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 24 12:10:46 2020 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Fri Apr 24 12:10:46 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bc069e0d

sys-libs/glibc: ppc stable wrt bug #712726

Package-Manager: Portage-2.3.89, Repoman-2.3.20
RepoMan-Options: --include-arches="ppc"
Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r8.ebuild | 2 +-
 sys-libs/glibc/glibc-2.30-r8.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.29-r8.ebuild b/sys-libs/glibc/glibc-2.29-r8.ebuild
index 83c66a1105c..b289e8f629e 100644
--- a/sys-libs/glibc/glibc-2.29-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ppc ~ppc64 ~riscv s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
index e10c8e18e39..3cc46c91a46 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ppc ~ppc64 ~riscv s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-24 12:11 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2020-04-24 12:11 UTC (permalink / raw
  To: gentoo-commits

commit:     f270e54e057dbf692fd72b33eca5181ee7712b35
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 24 12:11:14 2020 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Fri Apr 24 12:11:14 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f270e54e

sys-libs/glibc: ppc64 stable wrt bug #712726

Package-Manager: Portage-2.3.89, Repoman-2.3.20
RepoMan-Options: --include-arches="ppc64"
Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r8.ebuild | 2 +-
 sys-libs/glibc/glibc-2.30-r8.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.29-r8.ebuild b/sys-libs/glibc/glibc-2.29-r8.ebuild
index b289e8f629e..02547d1adcc 100644
--- a/sys-libs/glibc/glibc-2.29-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ppc ppc64 ~riscv s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
index 3cc46c91a46..15d0737e875 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ppc ppc64 ~riscv s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-04-24 12:11 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2020-04-24 12:11 UTC (permalink / raw
  To: gentoo-commits

commit:     462de3f128b9c0a71ab83ba95e8db06563ab05c5
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 24 12:11:42 2020 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Fri Apr 24 12:11:42 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=462de3f1

sys-libs/glibc: sparc stable wrt bug #712726

Package-Manager: Portage-2.3.89, Repoman-2.3.20
RepoMan-Options: --include-arches="sparc"
Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r8.ebuild | 2 +-
 sys-libs/glibc/glibc-2.30-r8.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.29-r8.ebuild b/sys-libs/glibc/glibc-2.29-r8.ebuild
index 02547d1adcc..b255df21e86 100644
--- a/sys-libs/glibc/glibc-2.29-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
index 15d0737e875..2836d93f552 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-05-02 19:51 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-05-02 19:51 UTC (permalink / raw
  To: gentoo-commits

commit:     59570004c5d29857e21d72c3ed98f933023d4861
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat May  2 19:51:08 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat May  2 19:51:21 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59570004

sys-libs/glibc: disable tst-pkey and tst-support_descriptors tests

tst-pkey did not hande -ENOSPC-as-unsupported untli glibc-2.31.
tst-support_descriptors is yet to be reported upstream.

Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r8.ebuild | 7 +++++++
 sys-libs/glibc/glibc-2.31-r2.ebuild | 4 ++++
 sys-libs/glibc/glibc-9999.ebuild    | 4 ++++
 3 files changed, 15 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
index 2836d93f552..efce95c6089 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -147,6 +147,13 @@ XFAIL_TEST_LIST=(
 	tst-locale-locpath
 	# 9) Failures of unknown origin
 	tst-latepthread
+
+	# buggy test, fixed in glibc-2.31 in 70ba28f7ab29
+	tst-pkey
+
+	# buggy test, assumes /dev/ and /dev/null on a single filesystem
+	# 'mount --bind /dev/null /chroot/dev/null' breaks it.
+	tst-support_descriptors
 )
 
 #

diff --git a/sys-libs/glibc/glibc-2.31-r2.ebuild b/sys-libs/glibc/glibc-2.31-r2.ebuild
index 2945adf1290..19510c320d4 100644
--- a/sys-libs/glibc/glibc-2.31-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r2.ebuild
@@ -141,6 +141,10 @@ GENTOO_GLIBC_XFAIL_TESTS="${GENTOO_GLIBC_XFAIL_TESTS:-yes}"
 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.
+	tst-support_descriptors
 )
 
 #

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index dafe72da8ed..589a69224e4 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -140,6 +140,10 @@ GENTOO_GLIBC_XFAIL_TESTS="${GENTOO_GLIBC_XFAIL_TESTS:-yes}"
 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.
+	tst-support_descriptors
 )
 
 #


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-05-02 20:08 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-05-02 20:08 UTC (permalink / raw
  To: gentoo-commits

commit:     e328f9953b360fcdf759881f2c83c0092ddd1abc
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat May  2 20:07:59 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat May  2 20:07:59 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e328f995

sys-libs/glibc: add a reference to disable support test

Bug: https://sourceware.org/PR25909
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r8.ebuild | 1 +
 sys-libs/glibc/glibc-2.31-r2.ebuild | 1 +
 sys-libs/glibc/glibc-9999.ebuild    | 1 +
 3 files changed, 3 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
index efce95c6089..430297d8706 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -153,6 +153,7 @@ XFAIL_TEST_LIST=(
 
 	# 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
 )
 

diff --git a/sys-libs/glibc/glibc-2.31-r2.ebuild b/sys-libs/glibc/glibc-2.31-r2.ebuild
index 19510c320d4..214f217af19 100644
--- a/sys-libs/glibc/glibc-2.31-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r2.ebuild
@@ -144,6 +144,7 @@ XFAIL_TEST_LIST=(
 
 	# 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
 )
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 589a69224e4..8b440f31782 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -143,6 +143,7 @@ XFAIL_TEST_LIST=(
 
 	# 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
 )
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-05-03 11:01 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-05-03 11:01 UTC (permalink / raw
  To: gentoo-commits

commit:     f55f2be1bd6791465453c7b0dfc60bf4c3c75613
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun May  3 11:01:18 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun May  3 11:01:35 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f55f2be1

sys-libs/glibc: disable flaky tst-stack4, bug #719674

tst-stack4 exposes known race condition in glibc
(https://sourceware.org/PR19329). Let's disable
this test until it's fixed upstream.

Reported-by: Sam James
Bug: https://bugs.gentoo.org/719674
Bug: https://sourceware.org/PR19329
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r8.ebuild | 5 +++++
 sys-libs/glibc/glibc-2.31-r2.ebuild | 5 +++++
 sys-libs/glibc/glibc-9999.ebuild    | 5 +++++
 3 files changed, 15 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
index 430297d8706..e5e446efc2f 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -155,6 +155,11 @@ XFAIL_TEST_LIST=(
 	# '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
 )
 
 #

diff --git a/sys-libs/glibc/glibc-2.31-r2.ebuild b/sys-libs/glibc/glibc-2.31-r2.ebuild
index 214f217af19..2648f673885 100644
--- a/sys-libs/glibc/glibc-2.31-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r2.ebuild
@@ -146,6 +146,11 @@ XFAIL_TEST_LIST=(
 	# '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
 )
 
 #

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 8b440f31782..aec5e3c69a7 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -145,6 +145,11 @@ XFAIL_TEST_LIST=(
 	# '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
 )
 
 #


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-05-04  6:16 Mart Raudsepp
  0 siblings, 0 replies; 1076+ messages in thread
From: Mart Raudsepp @ 2020-05-04  6:16 UTC (permalink / raw
  To: gentoo-commits

commit:     1d46ebb252fa5908bf548f0e6e2a1daface78433
Author:     Sam James (sam_c) <sam <AT> cmpct <DOT> info>
AuthorDate: Mon May  4 01:46:36 2020 +0000
Commit:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
CommitDate: Mon May  4 06:15:47 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1d46ebb2

sys-libs/glibc: arm64 stable (bug #712726)

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Sam James (sam_c) <sam <AT> cmpct.info>
Signed-off-by: Mart Raudsepp <leio <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r8.ebuild | 2 +-
 sys-libs/glibc/glibc-2.30-r8.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.29-r8.ebuild b/sys-libs/glibc/glibc-2.29-r8.ebuild
index b255df21e86..de5cc132585 100644
--- a/sys-libs/glibc/glibc-2.29-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
index e5e446efc2f..fb2c9a329b4 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-05-04 18:23 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-05-04 18:23 UTC (permalink / raw
  To: gentoo-commits

commit:     6ad75bd75d0e2bc8963b0caeb7de6d5d4a467058
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Mon May  4 18:14:15 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon May  4 18:22:57 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6ad75bd7

sys-libs/glibc: stable 2.29-r8 for hppa, bug #712726

Package-Manager: Portage-2.3.89, Repoman-2.3.20
RepoMan-Options: --include-arches="hppa"
Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.29-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.29-r8.ebuild b/sys-libs/glibc/glibc-2.29-r8.ebuild
index de5cc132585..a6120fcc153 100644
--- a/sys-libs/glibc/glibc-2.29-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-05-04 18:23 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-05-04 18:23 UTC (permalink / raw
  To: gentoo-commits

commit:     71dbe6d2141f45bedc5f6b3313b5ee4e22e7a556
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Mon May  4 18:15:09 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon May  4 18:22:57 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=71dbe6d2

sys-libs/glibc: stable 2.30-r8 for hppa, bug #712726

Package-Manager: Portage-2.3.89, Repoman-2.3.20
RepoMan-Options: --include-arches="hppa"
Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
index fb2c9a329b4..14ca4e95a44 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-05-04 18:32 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-05-04 18:32 UTC (permalink / raw
  To: gentoo-commits

commit:     e0bec9afbe073dd9ad9b97172385b1a268352e05
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon May  4 18:32:03 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon May  4 18:32:03 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e0bec9af

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.29-r7.ebuild | 1427 -----------------------------------
 2 files changed, 1428 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index d7c9f2505cf..9bbebceba8d 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -10,7 +10,6 @@ DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07
 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
 DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 4ab583be712994f949dee2512da6e12fd7f7ad73e96393f21678552b43da98f49321b53b5b009551300cdb09ca135e7f6adc636ff750c251a1d6d7f262dbc410 SHA512 e3f40ae6e9d06471c1a11bd2bce7b5161d07c3d0a81791505a72aec4817e7faf9ef09841e98c6dcf62a0a00754dff87dd194d97ac6b6354aeb2497cf60900b96
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
-DIST glibc-2.29-patches-8.tar.xz 102712 BLAKE2B 49aacff358c0f8499c444e73eec92f402b81236d6a91d1fc9864f974c5cb72fc5c87bf5ee77700a8333db4c68892b3940948158530cea0d0fbbda51df0ae7953 SHA512 7a929e023294e6b76569120cc234bc862f3e260994e56c3a2fc2b969b7313c94a47de7ef85f4e93c9083c16fde987ca470ab9d69d881ab49a22f5fd3a721703a
 DIST glibc-2.29-patches-9.tar.xz 104444 BLAKE2B 3c20891ee5c435925e67bbb641da54b6b7fe0114f5f1d3ea9e616414f9bafb4d32b4303f4f798507ee4e42227d68a543da203450b9bd10b61628cd0b3547725c SHA512 c38f23e78e313fe2a9e223b720e8fd93c7c57e8408c6bc3ceacbfde354fa5d963e3cb525fe75aad7aaf7347066c0e4a671c0553fe490888478ff909492fdd164
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-10.tar.xz 72808 BLAKE2B a7a95c99482524b2896d15539766f1e6b1fe34a22f32119248c6dd44f42632076e86fdcbbdc2d604ec73ceccdd8a7f5936a62a6f4c3d039fae8f6901dfc6be77 SHA512 af5e213ff08bf38f6f529816c36b4e38df27207c2df254609ebe45b2f039ab553bbe563aa6f64b6667d328fd2c120dc21b6e2676540bdd94e58079237089eac3

diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild
deleted file mode 100644
index 8b75be92edb..00000000000
--- a/sys-libs/glibc/glibc-2.29-r7.ebuild
+++ /dev/null
@@ -1,1427 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=8
-PATCH_DEV=dilfridge
-
-SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-devel/bison-2.7
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ -n ${ROOT} ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all no) )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-05-06  7:01 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-05-06  7:01 UTC (permalink / raw
  To: gentoo-commits

commit:     a98db11637ac67d5a244678db470d2e1837a9386
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed May  6 07:00:43 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed May  6 07:01:28 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a98db116

sys-libs/glibc: drop old

Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    8 -
 sys-libs/glibc/glibc-2.26-r7.ebuild |  857 ---------------------
 sys-libs/glibc/glibc-2.27-r6.ebuild | 1415 ----------------------------------
 sys-libs/glibc/glibc-2.28-r6.ebuild | 1412 ----------------------------------
 sys-libs/glibc/glibc-2.29-r8.ebuild | 1431 -----------------------------------
 5 files changed, 5123 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 9bbebceba8d..d9dbb5ba599 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -4,14 +4,6 @@ DIST glibc-2.19-patches-9.tar.bz2 24584 BLAKE2B a96e930a5bd20fa75d9f259cc2117fa5
 DIST glibc-2.19.tar.xz 12083312 BLAKE2B 9dc03346e0f0df4bf009a92d894b0a9f964ff92b7f4c9663cedf1cb6cf90435f28a15539d33791ecf43ee578fa4e26f916af0367651312ef8f9c1c38ce0dafa2 SHA512 9e021fcb3afbb9ace2a0e37fded231a62de861bd766e29d47163a03182e37add718b7acc3963d1c525f9556773e842297725715acde48dcfbaab6e756af1a23d
 DIST glibc-2.25-patches-15.tar.bz2 78320 BLAKE2B 70c62cc10db13e2844de4d8a18972e0f4d01ba52fbd40db57c11d7b1c2c0d571b894f01e762bb26632fd696a77c299ef0766e2f129d2eda896f58325a754a13c SHA512 7204218ea82b677e0f278c4752ddb90aa0c08ac2349d061de81ec91dac204b0f10fe223d7b1055b9e0c21dac97c835f913a90c0168a5000d3be00dd20027c185
 DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
-DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b217391156f897a8db50f65a69627d8f8cceded78414168986ee98eba038364a6b2f3599b23f95e7b0ad2643481c399718 SHA512 0c812a343fcc68c10d92117cb2a0cf1c255470e81f0a7a04d6db2fe35445e410ef37f15162f145c2eb772b08ab55af246f5b52f5e57c2e91038181f6f027abc3
-DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
-DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07c1edb24c3edaa1e0243b846b3832a40af1ba3a7b77aef04c54a173388156b464ea442fa8310a02e6f44e2ed5b78994286 SHA512 12496e9b0c60630dbec4c2febdd6d20df1f3d7a2c243cc55b595202b27f682b9208e16cd8c387687c0cc9e18b36c3caeef8d1b1148eb3ee8081431997270db5e
-DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
-DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 4ab583be712994f949dee2512da6e12fd7f7ad73e96393f21678552b43da98f49321b53b5b009551300cdb09ca135e7f6adc636ff750c251a1d6d7f262dbc410 SHA512 e3f40ae6e9d06471c1a11bd2bce7b5161d07c3d0a81791505a72aec4817e7faf9ef09841e98c6dcf62a0a00754dff87dd194d97ac6b6354aeb2497cf60900b96
-DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
-DIST glibc-2.29-patches-9.tar.xz 104444 BLAKE2B 3c20891ee5c435925e67bbb641da54b6b7fe0114f5f1d3ea9e616414f9bafb4d32b4303f4f798507ee4e42227d68a543da203450b9bd10b61628cd0b3547725c SHA512 c38f23e78e313fe2a9e223b720e8fd93c7c57e8408c6bc3ceacbfde354fa5d963e3cb525fe75aad7aaf7347066c0e4a671c0553fe490888478ff909492fdd164
-DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-10.tar.xz 72808 BLAKE2B a7a95c99482524b2896d15539766f1e6b1fe34a22f32119248c6dd44f42632076e86fdcbbdc2d604ec73ceccdd8a7f5936a62a6f4c3d039fae8f6901dfc6be77 SHA512 af5e213ff08bf38f6f529816c36b4e38df27207c2df254609ebe45b2f039ab553bbe563aa6f64b6667d328fd2c120dc21b6e2676540bdd94e58079237089eac3
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-4.tar.xz 40464 BLAKE2B 8c79b446a37be8f33c10b9fe987d2f55f285bf672a48bf307b60cbc322aadad1eec209b8d2ab88c023fcc718b08d089a151797e2b7352672234044ccd5eb9a9d SHA512 385de24a814646af3c8504ac1b76aa9d8ee5043d1e666656f7b31fc4a66c32b7c2a7b361b1a77e910182c07ff44bb1d228fd8de13a1915210035cad71251001a

diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild
deleted file mode 100644
index 95efd5f5139..00000000000
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild
+++ /dev/null
@@ -1,857 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix toolchain-funcs toolchain-glibc
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-EMULTILIB_PKG="true"
-
-# Configuration variables
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 s390 sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=7
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
-
-# Min kernel version glibc requires
-: ${NPTL_KERN_VER:="3.2.0"}
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we disable stripping
-# entirely.
-RESTRICT=strip
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	doc? ( sys-apps/texinfo )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.9
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.9
-		virtual/os-headers
-	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# the phases
-#
-
-pkg_pretend() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-		# The high rev # is to allow people to downgrade between -r# versions.
-		# We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine.
-		# Hopefully we never actually use a r# this high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction"
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
-		then
-			eerror "Your patched vendor kernel is broken.  You need to get an"
-			eerror "update from whoever is providing the kernel to you."
-			eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227"
-			eerror "https://bugs.gentoo.org/262698"
-			die "Keeping your system alive, say thank you"
-		fi
-
-		if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
-		then
-			eerror "Your old kernel is broken.  You need to update it to"
-			eerror "a newer version as syscall(<bignum>) will break."
-			eerror "https://bugs.gentoo.org/279260"
-			die "Keeping your system alive, say thank you"
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Make sure host system is up to date #394453
-	if has_version '<sys-libs/glibc-2.13' && \
-	   [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]]
-	then
-		ebegin "Scanning system for __guard to see if you need to rebuild first ..."
-		local files=$(
-			scanelf -qys__guard -F'#s%F' \
-				"${EROOT}"/*bin/ \
-				"${EROOT}"/lib* \
-				"${EROOT}"/usr/*bin/ \
-				"${EROOT}"/usr/lib* | \
-				egrep -v \
-					-e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \
-					-e "^${EROOT}/sbin/(ldconfig|sln)$"
-		)
-		[[ -z ${files} ]]
-		if ! eend $? ; then
-			eerror "Your system still has old SSP __guard symbols.  You need to"
-			eerror "rebuild all the packages that provide these files first:"
-			eerror "${files}"
-			die "old __guard detected"
-		fi
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-}
-
-src_unpack() {
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	# Check NPTL support _before_ we unpack things to save some time
-	check_nptl_support
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}"
-	touch locale/C-translit.h #185476 #218003
-
-	cd "${WORKDIR}"
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	if just_headers ; then
-		if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
-			# mips peeps like to screw with us.  if building headers,
-			# we don't have a real compiler, so we can't let them
-			# insert -mabi on us.
-			sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
-			find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
-		fi
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-	fi
-}
-
-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 $1"
-
-	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 ; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-
-	# The glibc configure script doesn't properly use LDFLAGS all the time.
-	export CC="$(tc-getCC ${CTARGET}) ${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)"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	# set addons
-	pushd "${S}" > /dev/null
-	local addons=$(echo */configure | sed \
-		-e 's:/configure::g' \
-		-e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
-		-e 's: \+$::' \
-		-e 's! !,!g' \
-		-e 's!^!,!' \
-		-e '/^,\*$/d')
-	[[ -d ports ]] && addons+=",ports"
-	popd > /dev/null
-
-	case ${CTARGET} in
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=all )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	if [[ $1 == "nptl" ]] ; then
-		myconf+=( --enable-kernel=${NPTL_KERN_VER} )
-	else
-		die "invalid pthread option"
-	fi
-	myconf+=( --enable-add-ons="${addons#,}" )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(in_iuse systemtap && use_enable systemtap)
-		$(in_iuse nscd && use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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 "$1")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	local addons
-	[[ -d ${S}/ports ]] && addons+=",ports"
-	myconf+=( --enable-add-ons="${addons#,}" )
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir $1)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test nptl
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if in_iuse suid && ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		cd "${ED}"$(alt_libdir)/..
-		[[ -e lib ]] || mkdir lib
-		cd "${ED}"$(alt_usrlibdir)/..
-		[[ -e lib ]] || mkdir lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		# if the host locales.gen contains no entries, we'll install everything
-		local locale_list="${EROOT}etc/locale.gen"
-		if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-			ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-			locale_list="${EROOT}usr/share/i18n/SUPPORTED"
-		fi
-		locale-gen -j $(makeopts_jobs) --config "${locale_list}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild
deleted file mode 100644
index 70de8f8358b..00000000000
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild
+++ /dev/null
@@ -1,1415 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 s390 sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=3
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps compile-locales doc gd hardened headers-only +multiarch multilib nscd profile selinux suid systemtap vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we disable stripping
-# entirely.
-RESTRICT=strip
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-devel/bison-2.7
-	doc? ( sys-apps/texinfo )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.9
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.9
-		virtual/os-headers
-	"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparc64v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparc64v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if version_is_at_least 2.8 ; then
-						cpu="sparcv9v2"
-					elif version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if version_is_at_least 2.4 ; then
-						cpu="sparcv9v"
-					elif version_is_at_least 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	filter-flags '-fstack-protector*'
-
-	# Starting with gcc-6 (and fully upstreamed pie patches) we control
-	# default enabled/disabled pie via use flags. So nothing to do
-	# here then. #618160
-	if [[ $(gcc-major-version) -lt 6 ]]; then
-		if use hardened && tc-enables-pie ; then
-			# Force PIC macro definition for all compilations since they're all
-			# either -fPIC or -fPIE with the default-PIE compiler.
-			append-cppflags -DPIC
-		else
-			# Don't build -fPIE without the default-PIE compiler and the
-			# hardened-pie patch
-			filter-flags -fPIE
-		fi
-	fi
-}
-
-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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	version_is_at_least ${nver} ${bver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers ; then
-		local run_kv build_kv want_kv
-
-		run_kv=$(g_get_running_KV)
-		build_kv=$(g_int_to_KV $(get_kheader_version))
-		want_kv=${MIN_KERN_VER}
-
-		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!"
-		fi
-
-		if ! is_crosscompile && ! tc-is-cross-compiler ; then
-			# Building fails on an non-supporting kernel
-			ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-			if ! eend_KV ${run_kv} ${want_kv} ; then
-				echo
-				eerror "You need a kernel of at least ${want_kv}!"
-				die "Kernel version too low!"
-			fi
-		fi
-
-		ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-		if ! eend_KV ${build_kv} ${want_kv} ; then
-			echo
-			eerror "You need linux-headers of at least ${want_kv}!"
-			die "linux-headers version too low!"
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}" || die
-	touch locale/C-translit.h || die #185476 #218003
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=all )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-		locale_list="${root}/usr/share/i18n/SUPPORTED"
-	fi
-
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild
deleted file mode 100644
index 1569309d3f9..00000000000
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild
+++ /dev/null
@@ -1,1412 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 s390 sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=9
-
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we disable stripping
-# entirely.
-RESTRICT="strip !test? ( test )"
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-devel/bison-2.7
-	doc? ( sys-apps/texinfo )
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-		virtual/os-headers
-	"
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
-			# try to pick a better one so glibc can use cpu-specific .S files.
-			# We key off the CFLAGS to get a good value.  Also need to handle
-			# version skew.
-			# We can't force users to set their CHOST to their exact machine
-			# as many of these are not recognized by config.sub/gcc and such :(.
-			# Note: If the mcpu values don't scale, we might try probing CPP defines.
-			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparc64v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparc64v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparc64b"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparc64b"
-					;;
-				*)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				niagara[234])
-					if ver_test -ge 2.8 ; then
-						cpu="sparcv9v2"
-					elif ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				niagara)
-					if ver_test -ge 2.4 ; then
-						cpu="sparcv9v"
-					elif ver_test -ge 2.2.3 ; then
-						cpu="sparcv9b"
-					else
-						cpu="sparcv9"
-					fi
-					;;
-				ultrasparc3)
-					cpu="sparcv9b"
-					;;
-				v9|ultrasparc)
-					cpu="sparcv9"
-					;;
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
-	einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${S}" || die
-	touch locale/C-translit.h || die #185476 #218003
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-	einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
-		*)
-			myconf+=( --enable-stack-protector=$(usex ssp all no) )
-			;;
-	esac
-	myconf+=( --enable-stackguard-randomization )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		--sysconfdir="${EPREFIX}/etc"
-		--localstatedir="${EPREFIX}/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="${EPREFIX}/sbin"
-	export libc_cv_slibdir="${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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="${EPREFIX}/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
-	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-		ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
-		locale_list="${root}/usr/share/i18n/SUPPORTED"
-	fi
-
-	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen "${ED}"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ ${ROOT} != "/" ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
-	fi
-
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.29-r8.ebuild b/sys-libs/glibc/glibc-2.29-r8.ebuild
deleted file mode 100644
index a6120fcc153..00000000000
--- a/sys-libs/glibc/glibc-2.29-r8.ebuild
+++ /dev/null
@@ -1,1431 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=9
-PATCH_DEV=slyfox
-
-SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-devel/bison-2.7
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.0.5 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.0.5
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake -s glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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' 2>/dev/null ; then
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		amd64)
-			# -march needed for #185404 #199334
-			# Note: This test only matters when the x86 ABI is enabled, so we could
-			# optimize a bit and elide it.
-			# TODO: See cross-compile issues listed above for 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' 2>/dev/null ; 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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Over-zealous CFLAGS can often cause problems.  What may work for one
-	# person may not work for another.  To avoid a large influx of bugs
-	# relating to failed builds, we strip most CFLAGS out to ensure as few
-	# problems as possible.
-	strip-flags
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# Lock glibc at -O2; we want to be conservative here.
-	# -fno-strict-aliasing is to work around #155906.
-	filter-flags '-O?'
-	append-flags -O2 -fno-strict-aliasing
-
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ -n ${ROOT} ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-	emake check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-05-11 20:53 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-05-11 20:53 UTC (permalink / raw
  To: gentoo-commits

commit:     c9f6a29817f5039507af213da5abb0254b13da19
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon May 11 20:52:29 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon May 11 20:52:29 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c9f6a298

sys-libs/glibc: drop devpts mount checks, bug #704780

This is the same as b793253be2f42
("sys-libs/glibc: drop devpts mount checks, bug #704780")
applied to stable ebuilds.

Toralf reports that sys-apps/bubblewrap also does not
follow tty group convention when mounts devpts. Let's
drop it from stable ebuilds as well.

Reported-by: Toralf Förster
Reported-by: Kai Krakow
Closes: https://bugs.gentoo.org/704780
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r8.ebuild | 24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
index 14ca4e95a44..aea0098e69f 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -516,27 +516,6 @@ glibc_banner() {
 	echo "${b}"
 }
 
-check_devpts() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.
-
-	# If merely building the binary package, then there's nothing to verify.
-	[[ ${MERGE_TYPE} == "buildonly" ]] && return
-
-	# Only sanity check when installing the native glibc.
-	[[ -n ${ROOT} ]] && return
-
-	# If they're opting in to the old suid code, then no need to check.
-	use suid && return
-
-	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
-		eerror "In order to use glibc with USE=-suid, you must make sure that"
-		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
-		eerror "Openrc should do this for you, so you should check /etc/fstab"
-		eerror "and make sure you do not have any invalid settings there."
-		die "mount & fix your /dev/pts settings"
-	fi
-}
-
 # The following Kernel version handling functions are mostly copied from portage
 # source. It's better not to use linux-info.eclass here since a) it adds too
 # much magic, see bug 326693 for some of the arguments, and b) some of the
@@ -606,9 +585,6 @@ get_kheader_version() {
 # pkg_ and src_ phases, so we call this function both in pkg_pretend and in
 # src_unpack.
 sanity_prechecks() {
-	# Make sure devpts is mounted correctly for use w/out setuid pt_chown
-	check_devpts
-
 	# Prevent native builds from downgrading
 	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
 	   [[ -z ${ROOT} ]] && \


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-05-12  5:05 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-05-12  5:05 UTC (permalink / raw
  To: gentoo-commits

commit:     cc79a30709cc296470454c1a13a40a3ed5639c37
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue May 12 05:02:54 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue May 12 05:05:21 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cc79a307

sys-libs/glibc: Use externally packaged locale-gen

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          |  1 +
 sys-libs/glibc/glibc-9999.ebuild | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index d9dbb5ba599..74611966866 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -9,3 +9,4 @@ DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811
 DIST glibc-2.31-patches-4.tar.xz 40464 BLAKE2B 8c79b446a37be8f33c10b9fe987d2f55f285bf672a48bf307b60cbc322aadad1eec209b8d2ab88c023fcc718b08d089a151797e2b7352672234044ccd5eb9a9d SHA512 385de24a814646af3c8504ac1b76aa9d8ee5043d1e666656f7b31fc4a66c32b7c2a7b361b1a77e910182c07ff44bb1d228fd8de13a1915210035cad71251001a
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-9999-patches-16.tar.xz 17736 BLAKE2B 772f5012ead8e27f5cf5fd2613de9a76ead2128ecd9324cc499e677ea3a96110cb0d4b1d3f12860ffa1267093db310503d7d873fb95060b0c1e046c6a60601d0 SHA512 eb885b7743ac88df7e9eb3a1cd415bc9eabff1c6bd00d32c4e50f1d9dfcc32419eb72ef06749b279d5b80a200a83bc951a851b8c96a023ab09a8a0c28045d563
+DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index aec5e3c69a7..32cac60af6e 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -28,10 +28,14 @@ RELEASE_VER=${PV}
 
 GCC_BOOTSTRAP_VER=20180511
 
+LOCALE_GEN_VER=2.00
+
 # Gentoo patchset
 PATCH_VER=16
+PATCH_DEV=slyfox
 
-SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
 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"
@@ -728,6 +732,8 @@ src_unpack() {
 
 	cd "${WORKDIR}" || die
 	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+
+	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
 }
 
 src_prepare() {
@@ -744,6 +750,12 @@ src_prepare() {
 	cd "${WORKDIR}"
 	find . -name configure -exec touch {} +
 
+	# until the patchset is updated
+	rm -rf extra/locale || die
+
+	# move the external locale-gen to its old place
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
 	eprefixify extra/locale/locale-gen
 
 	# Fix permissions on some of the scripts.


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-05-12 16:45 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-05-12 16:45 UTC (permalink / raw
  To: gentoo-commits

commit:     cf0da0e96521d48302d824d0bdaa4bb8b9530dab
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue May 12 16:44:40 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue May 12 16:45:40 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf0da0e9

sys-libs/glibc: 2.31 patchlv. bump; split locale-gen in separate repo

Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.31-r3.ebuild | 1465 +++++++++++++++++++++++++++++++++++
 2 files changed, 1466 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 74611966866..753e594e66c 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -7,6 +7,7 @@ DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1
 DIST glibc-2.30-patches-10.tar.xz 72808 BLAKE2B a7a95c99482524b2896d15539766f1e6b1fe34a22f32119248c6dd44f42632076e86fdcbbdc2d604ec73ceccdd8a7f5936a62a6f4c3d039fae8f6901dfc6be77 SHA512 af5e213ff08bf38f6f529816c36b4e38df27207c2df254609ebe45b2f039ab553bbe563aa6f64b6667d328fd2c120dc21b6e2676540bdd94e58079237089eac3
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-4.tar.xz 40464 BLAKE2B 8c79b446a37be8f33c10b9fe987d2f55f285bf672a48bf307b60cbc322aadad1eec209b8d2ab88c023fcc718b08d089a151797e2b7352672234044ccd5eb9a9d SHA512 385de24a814646af3c8504ac1b76aa9d8ee5043d1e666656f7b31fc4a66c32b7c2a7b361b1a77e910182c07ff44bb1d228fd8de13a1915210035cad71251001a
+DIST glibc-2.31-patches-5.tar.xz 52720 BLAKE2B 0e4315a79d4108e8a0eb2d849086de40a3ddebd9c09592ec5ecd02d9a0481f58588d7fca345624b0e345b077f6f3ad4257fb5949a0f05be2a004489af585a329 SHA512 c081aef22efacac19ce343ad6e55b8102869c42142dfd478e1cc03e85d6569771b52b737173df0996e273dc6ad1e8dea391658e03d5bcb69f2ed754801b3f6fa
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-9999-patches-16.tar.xz 17736 BLAKE2B 772f5012ead8e27f5cf5fd2613de9a76ead2128ecd9324cc499e677ea3a96110cb0d4b1d3f12860ffa1267093db310503d7d873fb95060b0c1e046c6a60601d0 SHA512 eb885b7743ac88df7e9eb3a1cd415bc9eabff1c6bd00d32c4e50f1d9dfcc32419eb72ef06749b279d5b80a200a83bc951a851b8c96a023ab09a8a0c28045d563
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff

diff --git a/sys-libs/glibc/glibc-2.31-r3.ebuild b/sys-libs/glibc/glibc-2.31-r3.ebuild
new file mode 100644
index 00000000000..b11334fe86e
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.31-r3.ebuild
@@ -0,0 +1,1465 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	# needs minimal testing
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+LOCALE_GEN_VER=2.00
+
+# Gentoo patchset
+PATCH_VER=5
+PATCH_DEV=dilfridge
+
+SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+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"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-devel/bison-2.7
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+
+	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-05-14 11:48 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-05-14 11:48 UTC (permalink / raw
  To: gentoo-commits

commit:     92630055717f66f3a85f273628722e3689c5340e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu May 14 11:47:50 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu May 14 11:48:31 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=92630055

sys-libs/glibc: In git version, pull patches directly from git too

Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          |  1 -
 sys-libs/glibc/glibc-9999.ebuild | 37 ++++++++++++++++++++++++-------------
 2 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 753e594e66c..e07373bab94 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -9,5 +9,4 @@ DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811
 DIST glibc-2.31-patches-4.tar.xz 40464 BLAKE2B 8c79b446a37be8f33c10b9fe987d2f55f285bf672a48bf307b60cbc322aadad1eec209b8d2ab88c023fcc718b08d089a151797e2b7352672234044ccd5eb9a9d SHA512 385de24a814646af3c8504ac1b76aa9d8ee5043d1e666656f7b31fc4a66c32b7c2a7b361b1a77e910182c07ff44bb1d228fd8de13a1915210035cad71251001a
 DIST glibc-2.31-patches-5.tar.xz 52720 BLAKE2B 0e4315a79d4108e8a0eb2d849086de40a3ddebd9c09592ec5ecd02d9a0481f58588d7fca345624b0e345b077f6f3ad4257fb5949a0f05be2a004489af585a329 SHA512 c081aef22efacac19ce343ad6e55b8102869c42142dfd478e1cc03e85d6569771b52b737173df0996e273dc6ad1e8dea391658e03d5bcb69f2ed754801b3f6fa
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
-DIST glibc-9999-patches-16.tar.xz 17736 BLAKE2B 772f5012ead8e27f5cf5fd2613de9a76ead2128ecd9324cc499e677ea3a96110cb0d4b1d3f12860ffa1267093db310503d7d873fb95060b0c1e046c6a60601d0 SHA512 eb885b7743ac88df7e9eb3a1cd415bc9eabff1c6bd00d32c4e50f1d9dfcc32419eb72ef06749b279d5b80a200a83bc951a851b8c96a023ab09a8a0c28045d563
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index cc1528ef61a..bba57f5d607 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -15,13 +15,17 @@ SLOT="2.2"
 
 EMULTILIB_PKG="true"
 
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=16
+PATCH_DEV=slyfox
+
 if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	inherit git-r3
 else
 	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
 	KEYWORDS=""
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi
 
 RELEASE_VER=${PV}
@@ -30,11 +34,6 @@ GCC_BOOTSTRAP_VER=20180511
 
 LOCALE_GEN_VER=2.00
 
-# Gentoo patchset
-PATCH_VER=16
-PATCH_DEV=slyfox
-
-SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
 
@@ -724,21 +723,35 @@ src_unpack() {
 
 	setup_env
 
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
 		git-r3_src_unpack
 	else
 		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
 	fi
 
 	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-
 	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
 }
 
 src_prepare() {
+	local patchsetname
 	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
 		eapply "${WORKDIR}"/patches
 		einfo "Done."
 	fi
@@ -750,10 +763,8 @@ src_prepare() {
 	cd "${WORKDIR}"
 	find . -name configure -exec touch {} +
 
-	# until the patchset is updated
-	rm -rf extra/locale || die
-
 	# move the external locale-gen to its old place
+	mkdir extra || die
 	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
 
 	eprefixify extra/locale/locale-gen


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-05-15 23:12 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-05-15 23:12 UTC (permalink / raw
  To: gentoo-commits

commit:     f43c7cd9e5a92d784af5e21ba22083cdb70c0e51
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri May 15 23:11:54 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri May 15 23:12:14 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f43c7cd9

sys-libs/glibc: avoid GPREL overflow on ia64, bug #723268

-fno-common had unintended side-effect to optimise more
accesses to global variables as module-local via GPREL22
relocations. Unfortunately glibc is large enough to overflow
GPREL22 offset.

Let's add a -fcommon workaround back to pessimize code slightly
that refers module-local globals. We'll need an equivalen of
-fPIC to do it consistently.

Bug: https://bugs.gentoo.org/723268
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r8.ebuild | 6 ++++++
 sys-libs/glibc/glibc-2.31-r3.ebuild | 6 ++++++
 sys-libs/glibc/glibc-9999.ebuild    | 6 ++++++
 3 files changed, 18 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
index aea0098e69f..0421d5e61db 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -305,6 +305,12 @@ setup_target_flags() {
 				einfo "Auto adding -march=${t} to CFLAGS_x86 #185404 (ABI=${ABI})"
 			fi
 		;;
+		ia64)
+			# Workaround GPREL22 overflow by slightly pessimizing global
+			# references to go via 64-bit relocations instead of 22-bit ones.
+			# This allows building glibc on ia64 without an overflow: #723268
+			append-flags -fcommon
+		;;
 		mips)
 			# The mips abi cannot support the GNU style hashes. #233233
 			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both

diff --git a/sys-libs/glibc/glibc-2.31-r3.ebuild b/sys-libs/glibc/glibc-2.31-r3.ebuild
index c05055b8811..5580625ba6d 100644
--- a/sys-libs/glibc/glibc-2.31-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r3.ebuild
@@ -299,6 +299,12 @@ setup_target_flags() {
 				einfo "Auto adding -march=${t} to CFLAGS_x86 #185404 (ABI=${ABI})"
 			fi
 		;;
+		ia64)
+			# Workaround GPREL22 overflow by slightly pessimizing global
+			# references to go via 64-bit relocations instead of 22-bit ones.
+			# This allows building glibc on ia64 without an overflow: #723268
+			append-flags -fcommon
+		;;
 		mips)
 			# The mips abi cannot support the GNU style hashes. #233233
 			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index bba57f5d607..2355e5bce34 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -298,6 +298,12 @@ setup_target_flags() {
 				einfo "Auto adding -march=${t} to CFLAGS_x86 #185404 (ABI=${ABI})"
 			fi
 		;;
+		ia64)
+			# Workaround GPREL22 overflow by slightly pessimizing global
+			# references to go via 64-bit relocations instead of 22-bit ones.
+			# This allows building glibc on ia64 without an overflow: #723268
+			append-flags -fcommon
+		;;
 		mips)
 			# The mips abi cannot support the GNU style hashes. #233233
 			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-05-16  8:58 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-05-16  8:58 UTC (permalink / raw
  To: gentoo-commits

commit:     8ec720b67f38952a4b9c6054c6d8ef0fc79d0343
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat May 16 08:57:53 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat May 16 08:58:04 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8ec720b6

sys-libs/glibc: use -mno-sdata, not -fcommon, bug #723268

-fcommon generated PLT references and added double memory
dereference.

-mno-sdata is slightly more efficient as it still sees
globals to be module local varilables and uses GPREL64
(instead of PLT indirection) and uses single memory
dereference.

Bug: https://bugs.gentoo.org/723268
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r8.ebuild | 3 ++-
 sys-libs/glibc/glibc-2.31-r3.ebuild | 3 ++-
 sys-libs/glibc/glibc-9999.ebuild    | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
index 0421d5e61db..b6a794f3004 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -309,7 +309,8 @@ setup_target_flags() {
 			# Workaround GPREL22 overflow by slightly pessimizing global
 			# references to go via 64-bit relocations instead of 22-bit ones.
 			# This allows building glibc on ia64 without an overflow: #723268
-			append-flags -fcommon
+			append-flags -mno-sdata
+			:
 		;;
 		mips)
 			# The mips abi cannot support the GNU style hashes. #233233

diff --git a/sys-libs/glibc/glibc-2.31-r3.ebuild b/sys-libs/glibc/glibc-2.31-r3.ebuild
index 5580625ba6d..d297db2b26d 100644
--- a/sys-libs/glibc/glibc-2.31-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r3.ebuild
@@ -303,7 +303,8 @@ setup_target_flags() {
 			# Workaround GPREL22 overflow by slightly pessimizing global
 			# references to go via 64-bit relocations instead of 22-bit ones.
 			# This allows building glibc on ia64 without an overflow: #723268
-			append-flags -fcommon
+			append-flags -mno-sdata
+			:
 		;;
 		mips)
 			# The mips abi cannot support the GNU style hashes. #233233

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2355e5bce34..ccedec70c67 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -302,7 +302,8 @@ setup_target_flags() {
 			# Workaround GPREL22 overflow by slightly pessimizing global
 			# references to go via 64-bit relocations instead of 22-bit ones.
 			# This allows building glibc on ia64 without an overflow: #723268
-			append-flags -fcommon
+			append-flags -mno-sdata
+			:
 		;;
 		mips)
 			# The mips abi cannot support the GNU style hashes. #233233


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-05-16 11:30 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-05-16 11:30 UTC (permalink / raw
  To: gentoo-commits

commit:     c6c63ec156e40e8b28724f2b49a8b0cf2ebf3033
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat May 16 11:27:17 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat May 16 11:30:49 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c6c63ec1

sys-libs/glibc: revert "use -mno-sdata, not -fcommon, bug #723268"

The underying linker failure cause is not just an overflow
but a functional difference in '_dl_sysinfo_break' symbol linkage.

'_dl_sysinfo_break' is defined as a function in assembly
but declared as a global 'common' variable. Making it non-common
actually breaks sysinfo handler which is expected to be called
without function descriptor indirection. As sysonfo handler
is called before rtld processed it's own relocations.

Let's revert back to -fcommon until we have better glibc fix.

This reverts commit 8ec720b67f38952a4b9c6054c6d8ef0fc79d0343.

Bug: https://bugs.gentoo.org/723268
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r8.ebuild | 3 +--
 sys-libs/glibc/glibc-2.31-r3.ebuild | 3 +--
 sys-libs/glibc/glibc-9999.ebuild    | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
index b6a794f3004..0421d5e61db 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -309,8 +309,7 @@ setup_target_flags() {
 			# Workaround GPREL22 overflow by slightly pessimizing global
 			# references to go via 64-bit relocations instead of 22-bit ones.
 			# This allows building glibc on ia64 without an overflow: #723268
-			append-flags -mno-sdata
-			:
+			append-flags -fcommon
 		;;
 		mips)
 			# The mips abi cannot support the GNU style hashes. #233233

diff --git a/sys-libs/glibc/glibc-2.31-r3.ebuild b/sys-libs/glibc/glibc-2.31-r3.ebuild
index d297db2b26d..5580625ba6d 100644
--- a/sys-libs/glibc/glibc-2.31-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r3.ebuild
@@ -303,8 +303,7 @@ setup_target_flags() {
 			# Workaround GPREL22 overflow by slightly pessimizing global
 			# references to go via 64-bit relocations instead of 22-bit ones.
 			# This allows building glibc on ia64 without an overflow: #723268
-			append-flags -mno-sdata
-			:
+			append-flags -fcommon
 		;;
 		mips)
 			# The mips abi cannot support the GNU style hashes. #233233

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ccedec70c67..2355e5bce34 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -302,8 +302,7 @@ setup_target_flags() {
 			# Workaround GPREL22 overflow by slightly pessimizing global
 			# references to go via 64-bit relocations instead of 22-bit ones.
 			# This allows building glibc on ia64 without an overflow: #723268
-			append-flags -mno-sdata
-			:
+			append-flags -fcommon
 		;;
 		mips)
 			# The mips abi cannot support the GNU style hashes. #233233


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-06-08 22:04 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-06-08 22:04 UTC (permalink / raw
  To: gentoo-commits

commit:     97e3d34a588fad1db19369bbe9787d1c21fc3616
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  8 22:03:43 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon Jun  8 22:04:23 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=97e3d34a

sys-libs/glibc: backport sparc register clobber to 2.30, 2.31

Initially reported by Rolf Eike Beer as test hangups
on app-shells/fish-3.0.2 and nailed down by ridiculousfish
as as breakage in `posix_spawn` implementation where
one of syscall parameters was clobbered before being
passed to kernel.

Both glibc-2.30 and 2.31 got a backport of upstream commit
c261718b3fda ("sparc: Avoid clobbering register parameters in syscall").

Reported-by: Rolf Eike Beer
Bug: https://bugs.gentoo.org/709662
Bug: https://github.com/fish-shell/fish-shell/issues/6878
Package-Manager: Portage-2.3.100, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    3 +
 sys-libs/glibc/glibc-2.30-r9.ebuild | 1468 ++++++++++++++++++++++++++++++++++
 sys-libs/glibc/glibc-2.31-r4.ebuild | 1478 +++++++++++++++++++++++++++++++++++
 3 files changed, 2949 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index e07373bab94..f3a33e96933 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -5,8 +5,11 @@ DIST glibc-2.19.tar.xz 12083312 BLAKE2B 9dc03346e0f0df4bf009a92d894b0a9f964ff92b
 DIST glibc-2.25-patches-15.tar.bz2 78320 BLAKE2B 70c62cc10db13e2844de4d8a18972e0f4d01ba52fbd40db57c11d7b1c2c0d571b894f01e762bb26632fd696a77c299ef0766e2f129d2eda896f58325a754a13c SHA512 7204218ea82b677e0f278c4752ddb90aa0c08ac2349d061de81ec91dac204b0f10fe223d7b1055b9e0c21dac97c835f913a90c0168a5000d3be00dd20027c185
 DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
 DIST glibc-2.30-patches-10.tar.xz 72808 BLAKE2B a7a95c99482524b2896d15539766f1e6b1fe34a22f32119248c6dd44f42632076e86fdcbbdc2d604ec73ceccdd8a7f5936a62a6f4c3d039fae8f6901dfc6be77 SHA512 af5e213ff08bf38f6f529816c36b4e38df27207c2df254609ebe45b2f039ab553bbe563aa6f64b6667d328fd2c120dc21b6e2676540bdd94e58079237089eac3
+DIST glibc-2.30-sparc-reg-fix-clobber.patch 6106 BLAKE2B cad6a4cbef5d529519ef486f4ef8e189cb4d43dd67fa8f8d50d67072cbb682f60474d482a5c5152d1317de92b98851d8a88eee6b331eb5bc22de065c03c58fde SHA512 a018ef1f196257f3888af20a5cbc97892c8382a4f489da042568e087c077f30cf4dda6ac711b573e1274317866ce97cf817d92a28cf55f18f5e8d32787e6cb3f
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-4.tar.xz 40464 BLAKE2B 8c79b446a37be8f33c10b9fe987d2f55f285bf672a48bf307b60cbc322aadad1eec209b8d2ab88c023fcc718b08d089a151797e2b7352672234044ccd5eb9a9d SHA512 385de24a814646af3c8504ac1b76aa9d8ee5043d1e666656f7b31fc4a66c32b7c2a7b361b1a77e910182c07ff44bb1d228fd8de13a1915210035cad71251001a
 DIST glibc-2.31-patches-5.tar.xz 52720 BLAKE2B 0e4315a79d4108e8a0eb2d849086de40a3ddebd9c09592ec5ecd02d9a0481f58588d7fca345624b0e345b077f6f3ad4257fb5949a0f05be2a004489af585a329 SHA512 c081aef22efacac19ce343ad6e55b8102869c42142dfd478e1cc03e85d6569771b52b737173df0996e273dc6ad1e8dea391658e03d5bcb69f2ed754801b3f6fa
+DIST glibc-2.31-sparc-patch1-reg-kabi.patch 8525 BLAKE2B 2600ba4b0e24df2054a6e77ef79b6e5312e5594714d78015c4a949bb2c9b29c9535121bed9d633215710f6f50525fa0d2864aea43abbfeae281a6cc3dab71e5d SHA512 8dab29ea2e9e809806df17f3b707e7be27ac37121d0e3c6ee52fd41c1d6891bf71c0d8c154593754531aee96f8c866e06646f149c8bdd602521b703471d56bd2
+DIST glibc-2.31-sparc-patch2-reg-fix-clobber.patch 6864 BLAKE2B a39a10ff204d74289278125d7f2686db01874e998cb27b46b3b8b9597b5a2eae3b975a5ab08a8f5dd83693455891f6862b6eb70654f215c2ce6c5da222be96a1 SHA512 69bba011a30177386193ac4ac14a4e731c45b12dbb3745619ee802459aa75d6bbd37e62e979ec9790f691edb5f9077d37ee668b8df406f8f1c4d4316ef8c0aa7
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff

diff --git a/sys-libs/glibc/glibc-2.30-r9.ebuild b/sys-libs/glibc/glibc-2.30-r9.ebuild
new file mode 100644
index 00000000000..8d5a9d67f55
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.30-r9.ebuild
@@ -0,0 +1,1468 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+# Gentoo patchset
+PATCH_VER=10
+PATCH_DEV=dilfridge
+
+SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/glibc-2.30-sparc-reg-fix-clobber.patch"
+
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-devel/bison-2.7
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 1) Sandbox
+	tst-ldconfig-bad-aux-cache
+	tst-pldd
+	tst-mallocfork2
+	tst-nss-db-endgrent
+	tst-nss-db-endpwent
+	tst-nss-files-hosts-long
+	tst-nss-test3
+	# 2) Namespaces and cgroup
+	tst-locale-locpath
+	# 9) Failures of unknown origin
+	tst-latepthread
+
+	# buggy test, fixed in glibc-2.31 in 70ba28f7ab29
+	tst-pkey
+
+	# 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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		ia64)
+			# Workaround GPREL22 overflow by slightly pessimizing global
+			# references to go via 64-bit relocations instead of 22-bit ones.
+			# This allows building glibc on ia64 without an overflow: #723268
+			append-flags -fcommon
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		eapply "${DISTDIR}"/glibc-2.30-sparc-reg-fix-clobber.patch
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
+	doins "${WORKDIR}"/extra/etc/*.conf
+
+	if use nscd ; then
+		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	else
+		# Do this since extra/etc/*.conf above might have nscd.conf.
+		rm -f "${ED}"/etc/nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}

diff --git a/sys-libs/glibc/glibc-2.31-r4.ebuild b/sys-libs/glibc/glibc-2.31-r4.ebuild
new file mode 100644
index 00000000000..24d169cae7a
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.31-r4.ebuild
@@ -0,0 +1,1478 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+if [[ ${PV} == 9999* ]]; then
+	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+	inherit git-r3
+else
+	# needs minimal testing
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+LOCALE_GEN_VER=2.00
+
+# Gentoo patchset
+PATCH_VER=5
+PATCH_DEV=dilfridge
+
+SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+SRC_URI+="
+	https://dev.gentoo.org/~slyfox/distfiles/glibc-2.31-sparc-patch1-reg-kabi.patch
+	https://dev.gentoo.org/~slyfox/distfiles/glibc-2.31-sparc-patch2-reg-fix-clobber.patch
+"
+
+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"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-devel/bison-2.7
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		ia64)
+			# Workaround GPREL22 overflow by slightly pessimizing global
+			# references to go via 64-bit relocations instead of 22-bit ones.
+			# This allows building glibc on ia64 without an overflow: #723268
+			append-flags -fcommon
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	setup_env
+
+	if [[ -n ${EGIT_REPO_URI} ]] ; then
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+
+	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+}
+
+src_prepare() {
+	if ! use vanilla ; then
+		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
+		eapply "${WORKDIR}"/patches
+		eapply "${DISTDIR}"/glibc-2.31-sparc-patch1-reg-kabi.patch
+		eapply "${DISTDIR}"/glibc-2.31-sparc-patch2-reg-fix-clobber.patch
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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 ; 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}"
+
+	echo
+
+	local myconf=()
+
+	case ${CTARGET} in
+		m68k*)
+			# setjmp() is not compatible with stack protection:
+			# https://sourceware.org/PR24202
+			myconf+=( --enable-stack-protector=no )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins posix/gai.conf nss/nsswitch.conf
+
+	# Gentoo-specific
+	newins "${FILESDIR}"/host.conf-1 host.conf
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-06-09  7:24 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-06-09  7:24 UTC (permalink / raw
  To: gentoo-commits

commit:     b6558b4251e9dacfb8a866716820e43a7dc5d0fe
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  9 07:23:10 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Jun  9 07:24:07 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b6558b42

sys-libs/glibc: always use NM and READELF for default ABI

sys-devel/binutils-config[-native-symlinks] exposed a bug of
not using 'readelf' / 'nm' if used ABI is not default.
Breakage mahifested as ./configure failure for glibc[static-pie]
for non-default ABIs.

The fix uses NM and READELF from default ABI (specified by CTARGET).

While at it set CC in early compile test checks.

Package-Manager: Portage-2.3.100, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r4.ebuild | 13 +++++++++++--
 sys-libs/glibc/glibc-9999.ebuild    | 13 +++++++++++--
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.31-r4.ebuild b/sys-libs/glibc/glibc-2.31-r4.ebuild
index 24d169cae7a..487ca85ae40 100644
--- a/sys-libs/glibc/glibc-2.31-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r4.ebuild
@@ -230,7 +230,8 @@ do_compile_test() {
 	rm -f glibc-test*
 	printf '%b' "$*" > glibc-test.c
 
-	nonfatal emake glibc-test
+	# Most of the time CC is already set, but not in early sanity checks.
+	nonfatal emake glibc-test CC="${CC-$(tc-getCC ${CTARGET})}"
 	ret=$?
 
 	popd >/dev/null
@@ -790,7 +791,7 @@ glibc_do_configure() {
 	fi
 
 	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO ; do
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM READELF; do
 		einfo " $(printf '%15s' ${v}:)   ${!v}"
 	done
 
@@ -819,6 +820,14 @@ glibc_do_configure() {
 	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=()

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2355e5bce34..236e15c0792 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -225,7 +225,8 @@ do_compile_test() {
 	rm -f glibc-test*
 	printf '%b' "$*" > glibc-test.c
 
-	nonfatal emake glibc-test
+	# Most of the time CC is already set, but not in early sanity checks.
+	nonfatal emake glibc-test CC="${CC-$(tc-getCC ${CTARGET})}"
 	ret=$?
 
 	popd >/dev/null
@@ -798,7 +799,7 @@ glibc_do_configure() {
 	fi
 
 	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO ; do
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM READELF; do
 		einfo " $(printf '%15s' ${v}:)   ${!v}"
 	done
 
@@ -827,6 +828,14 @@ glibc_do_configure() {
 	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=()


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-06-10  8:15 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-06-10  8:15 UTC (permalink / raw
  To: gentoo-commits

commit:     750d6fda7727b2d4532fd40bd8702156b1960700
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 10 08:14:30 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jun 10 08:15:01 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=750d6fda

sys-libs/glibc: 2.31 patchset and patchset logic bump

Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.31-r5.ebuild | 1495 +++++++++++++++++++++++++++++++++++
 2 files changed, 1496 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index f3a33e96933..49ad10ddbac 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -9,6 +9,7 @@ DIST glibc-2.30-sparc-reg-fix-clobber.patch 6106 BLAKE2B cad6a4cbef5d529519ef486
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-4.tar.xz 40464 BLAKE2B 8c79b446a37be8f33c10b9fe987d2f55f285bf672a48bf307b60cbc322aadad1eec209b8d2ab88c023fcc718b08d089a151797e2b7352672234044ccd5eb9a9d SHA512 385de24a814646af3c8504ac1b76aa9d8ee5043d1e666656f7b31fc4a66c32b7c2a7b361b1a77e910182c07ff44bb1d228fd8de13a1915210035cad71251001a
 DIST glibc-2.31-patches-5.tar.xz 52720 BLAKE2B 0e4315a79d4108e8a0eb2d849086de40a3ddebd9c09592ec5ecd02d9a0481f58588d7fca345624b0e345b077f6f3ad4257fb5949a0f05be2a004489af585a329 SHA512 c081aef22efacac19ce343ad6e55b8102869c42142dfd478e1cc03e85d6569771b52b737173df0996e273dc6ad1e8dea391658e03d5bcb69f2ed754801b3f6fa
+DIST glibc-2.31-patches-7.tar.xz 56088 BLAKE2B 5af4dc008775c7d7958fc03df3800855685d00af7312f024a966948bd85522d40f357288deb4f13281dc93ace1b08cf40edf0b4c573dcba789887e86b45ce6ed SHA512 059082e5ce052189ed0c36ee97d7295f88cbb9e20dcb5677565a65d60cba11ff969d4382b6c6a69b8d6255da7274c205cf5c167fe76a24db3b9765f1633a9962
 DIST glibc-2.31-sparc-patch1-reg-kabi.patch 8525 BLAKE2B 2600ba4b0e24df2054a6e77ef79b6e5312e5594714d78015c4a949bb2c9b29c9535121bed9d633215710f6f50525fa0d2864aea43abbfeae281a6cc3dab71e5d SHA512 8dab29ea2e9e809806df17f3b707e7be27ac37121d0e3c6ee52fd41c1d6891bf71c0d8c154593754531aee96f8c866e06646f149c8bdd602521b703471d56bd2
 DIST glibc-2.31-sparc-patch2-reg-fix-clobber.patch 6864 BLAKE2B a39a10ff204d74289278125d7f2686db01874e998cb27b46b3b8b9597b5a2eae3b975a5ab08a8f5dd83693455891f6862b6eb70654f215c2ce6c5da222be96a1 SHA512 69bba011a30177386193ac4ac14a4e731c45b12dbb3745619ee802459aa75d6bbd37e62e979ec9790f691edb5f9077d37ee668b8df406f8f1c4d4316ef8c0aa7
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306

diff --git a/sys-libs/glibc/glibc-2.31-r5.ebuild b/sys-libs/glibc/glibc-2.31-r5.ebuild
new file mode 100644
index 00000000000..c3ecf51a239
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.31-r5.ebuild
@@ -0,0 +1,1495 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=7
+PATCH_DEV=dilfridge
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	KEYWORDS=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+LOCALE_GEN_VER=2.00
+
+SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+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"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	!<sys-devel/bison-2.7
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		ia64)
+			# Workaround GPREL22 overflow by slightly pessimizing global
+			# references to go via 64-bit relocations instead of 22-bit ones.
+			# This allows building glibc on ia64 without an overflow: #723268
+			append-flags -fcommon
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && 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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+}
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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
+		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 )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins posix/gai.conf nss/nsswitch.conf
+
+	# Gentoo-specific
+	newins "${FILESDIR}"/host.conf-1 host.conf
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-06-10  8:17 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-06-10  8:17 UTC (permalink / raw
  To: gentoo-commits

commit:     38a0ceac7f3fdbda01091bdb9a041662945aa582
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 10 08:17:12 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Jun 10 08:17:31 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=38a0ceac

sys-libs/glibc: stable 2.30-r9 for sparc

Fast-stabilize on sparc to move users faster off glibc
with miscompiled syscall wrappers.

Reported-by: Rolf Eike Beer
Closes: https://bugs.gentoo.org/709662
Package-Manager: Portage-2.3.100, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.30-r9.ebuild b/sys-libs/glibc/glibc-2.30-r9.ebuild
index 8d5a9d67f55..1c74a071215 100644
--- a/sys-libs/glibc/glibc-2.30-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r9.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-06-10  9:16 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-06-10  9:16 UTC (permalink / raw
  To: gentoo-commits

commit:     1849f8a4051b42529a62a2f23c5c6cfad2a08813
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 10 09:16:06 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jun 10 09:16:40 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1849f8a4

sys-libs/glibc: Remove old

Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.31-r2.ebuild | 1457 ----------------------------------
 sys-libs/glibc/glibc-2.31-r3.ebuild | 1472 -----------------------------------
 3 files changed, 2930 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 49ad10ddbac..6ad1c2283fe 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -7,7 +7,6 @@ DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1
 DIST glibc-2.30-patches-10.tar.xz 72808 BLAKE2B a7a95c99482524b2896d15539766f1e6b1fe34a22f32119248c6dd44f42632076e86fdcbbdc2d604ec73ceccdd8a7f5936a62a6f4c3d039fae8f6901dfc6be77 SHA512 af5e213ff08bf38f6f529816c36b4e38df27207c2df254609ebe45b2f039ab553bbe563aa6f64b6667d328fd2c120dc21b6e2676540bdd94e58079237089eac3
 DIST glibc-2.30-sparc-reg-fix-clobber.patch 6106 BLAKE2B cad6a4cbef5d529519ef486f4ef8e189cb4d43dd67fa8f8d50d67072cbb682f60474d482a5c5152d1317de92b98851d8a88eee6b331eb5bc22de065c03c58fde SHA512 a018ef1f196257f3888af20a5cbc97892c8382a4f489da042568e087c077f30cf4dda6ac711b573e1274317866ce97cf817d92a28cf55f18f5e8d32787e6cb3f
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
-DIST glibc-2.31-patches-4.tar.xz 40464 BLAKE2B 8c79b446a37be8f33c10b9fe987d2f55f285bf672a48bf307b60cbc322aadad1eec209b8d2ab88c023fcc718b08d089a151797e2b7352672234044ccd5eb9a9d SHA512 385de24a814646af3c8504ac1b76aa9d8ee5043d1e666656f7b31fc4a66c32b7c2a7b361b1a77e910182c07ff44bb1d228fd8de13a1915210035cad71251001a
 DIST glibc-2.31-patches-5.tar.xz 52720 BLAKE2B 0e4315a79d4108e8a0eb2d849086de40a3ddebd9c09592ec5ecd02d9a0481f58588d7fca345624b0e345b077f6f3ad4257fb5949a0f05be2a004489af585a329 SHA512 c081aef22efacac19ce343ad6e55b8102869c42142dfd478e1cc03e85d6569771b52b737173df0996e273dc6ad1e8dea391658e03d5bcb69f2ed754801b3f6fa
 DIST glibc-2.31-patches-7.tar.xz 56088 BLAKE2B 5af4dc008775c7d7958fc03df3800855685d00af7312f024a966948bd85522d40f357288deb4f13281dc93ace1b08cf40edf0b4c573dcba789887e86b45ce6ed SHA512 059082e5ce052189ed0c36ee97d7295f88cbb9e20dcb5677565a65d60cba11ff969d4382b6c6a69b8d6255da7274c205cf5c167fe76a24db3b9765f1633a9962
 DIST glibc-2.31-sparc-patch1-reg-kabi.patch 8525 BLAKE2B 2600ba4b0e24df2054a6e77ef79b6e5312e5594714d78015c4a949bb2c9b29c9535121bed9d633215710f6f50525fa0d2864aea43abbfeae281a6cc3dab71e5d SHA512 8dab29ea2e9e809806df17f3b707e7be27ac37121d0e3c6ee52fd41c1d6891bf71c0d8c154593754531aee96f8c866e06646f149c8bdd602521b703471d56bd2

diff --git a/sys-libs/glibc/glibc-2.31-r2.ebuild b/sys-libs/glibc/glibc-2.31-r2.ebuild
deleted file mode 100644
index 2648f673885..00000000000
--- a/sys-libs/glibc/glibc-2.31-r2.ebuild
+++ /dev/null
@@ -1,1457 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7,8} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	# needs minimal testing
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=4
-PATCH_DEV=dilfridge
-
-SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-devel/bison-2.7
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.31-r3.ebuild b/sys-libs/glibc/glibc-2.31-r3.ebuild
deleted file mode 100644
index 5580625ba6d..00000000000
--- a/sys-libs/glibc/glibc-2.31-r3.ebuild
+++ /dev/null
@@ -1,1472 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7,8} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	# needs minimal testing
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-LOCALE_GEN_VER=2.00
-
-# Gentoo patchset
-PATCH_VER=5
-PATCH_DEV=dilfridge
-
-SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	!<sys-devel/bison-2.7
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		ia64)
-			# Workaround GPREL22 overflow by slightly pessimizing global
-			# references to go via 64-bit relocations instead of 22-bit ones.
-			# This allows building glibc on ia64 without an overflow: #723268
-			append-flags -fcommon
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-
-	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins posix/gai.conf nss/nsswitch.conf
-
-	# Gentoo-specific
-	newins "${FILESDIR}"/host.conf-1 host.conf
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-06-10  9:16 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-06-10  9:16 UTC (permalink / raw
  To: gentoo-commits

commit:     fa934551900f22f4debccaec69ea68285cec20f5
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 10 09:15:30 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jun 10 09:16:36 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fa934551

sys-libs/glibc: Restore keywords

Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r5.ebuild | 3 +--
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.31-r5.ebuild b/sys-libs/glibc/glibc-2.31-r5.ebuild
index c3ecf51a239..6e3ecc03699 100644
--- a/sys-libs/glibc/glibc-2.31-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r5.ebuild
@@ -22,8 +22,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
-	KEYWORDS=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 236e15c0792..2159f471f18 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -22,7 +22,7 @@ PATCH_DEV=slyfox
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	KEYWORDS=""
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-06-28 22:13 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-06-28 22:13 UTC (permalink / raw
  To: gentoo-commits

commit:     8fe34f4b34ef6dd1e29bb87f34a8f519c9248b99
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 28 22:12:57 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jun 28 22:13:11 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8fe34f4b

sys-libs/glibc: drop DEPEND="!<sys-devel/bison-2.7" blocker

Package-Manager: Portage-2.3.103, Repoman-2.3.23
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild | 1 -
 sys-libs/glibc/glibc-2.30-r8.ebuild | 1 -
 sys-libs/glibc/glibc-2.30-r9.ebuild | 1 -
 sys-libs/glibc/glibc-2.31-r4.ebuild | 1 -
 sys-libs/glibc/glibc-2.31-r5.ebuild | 1 -
 sys-libs/glibc/glibc-9999.ebuild    | 1 -
 6 files changed, 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index e8877a90634..3b45b557922 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -94,7 +94,6 @@ COMMON_DEPEND="
 "
 DEPEND="${COMMON_DEPEND}
 	>=app-misc/pax-utils-0.1.10
-	!<sys-devel/bison-2.7
 	doc? ( sys-apps/texinfo )
 "
 RDEPEND="${COMMON_DEPEND}

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
index 0421d5e61db..4888fb0aa86 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -88,7 +88,6 @@ BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-devel/bison-2.7
 	doc? ( sys-apps/texinfo )
 "
 COMMON_DEPEND="

diff --git a/sys-libs/glibc/glibc-2.30-r9.ebuild b/sys-libs/glibc/glibc-2.30-r9.ebuild
index 1c74a071215..11a2b4d878c 100644
--- a/sys-libs/glibc/glibc-2.30-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r9.ebuild
@@ -89,7 +89,6 @@ BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-devel/bison-2.7
 	doc? ( sys-apps/texinfo )
 "
 COMMON_DEPEND="

diff --git a/sys-libs/glibc/glibc-2.31-r4.ebuild b/sys-libs/glibc/glibc-2.31-r4.ebuild
index 487ca85ae40..f4831ba151d 100644
--- a/sys-libs/glibc/glibc-2.31-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r4.ebuild
@@ -98,7 +98,6 @@ BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-devel/bison-2.7
 	doc? ( sys-apps/texinfo )
 "
 COMMON_DEPEND="

diff --git a/sys-libs/glibc/glibc-2.31-r5.ebuild b/sys-libs/glibc/glibc-2.31-r5.ebuild
index 6e3ecc03699..897a2582eb9 100644
--- a/sys-libs/glibc/glibc-2.31-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r5.ebuild
@@ -92,7 +92,6 @@ BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-devel/bison-2.7
 	doc? ( sys-apps/texinfo )
 "
 COMMON_DEPEND="

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2159f471f18..ca5f697b063 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -93,7 +93,6 @@ BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
-	!<sys-devel/bison-2.7
 	doc? ( sys-apps/texinfo )
 "
 COMMON_DEPEND="


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-07-18 15:59 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-07-18 15:59 UTC (permalink / raw
  To: gentoo-commits

commit:     52632cc8ba2004c94830358ef992c1a4a3572ad1
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 18 15:56:14 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jul 18 15:58:51 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=52632cc8

sys-libs/glibc: 2.31 bump to patchset 8, finally stable candidate

* arm: fix for CVE-2020-6096
* en_US: minimize changes to date_fmt (backport from 2.32)
* x86-64: fix avx2 strncmp offset compare condition check
* ia64: fix miscompilation on gcc-10

Package-Manager: Portage-2.3.99, Repoman-2.3.23
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.31-r6.ebuild | 1493 +++++++++++++++++++++++++++++++++++
 2 files changed, 1494 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 6ad1c2283fe..48815d21618 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -9,6 +9,7 @@ DIST glibc-2.30-sparc-reg-fix-clobber.patch 6106 BLAKE2B cad6a4cbef5d529519ef486
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-5.tar.xz 52720 BLAKE2B 0e4315a79d4108e8a0eb2d849086de40a3ddebd9c09592ec5ecd02d9a0481f58588d7fca345624b0e345b077f6f3ad4257fb5949a0f05be2a004489af585a329 SHA512 c081aef22efacac19ce343ad6e55b8102869c42142dfd478e1cc03e85d6569771b52b737173df0996e273dc6ad1e8dea391658e03d5bcb69f2ed754801b3f6fa
 DIST glibc-2.31-patches-7.tar.xz 56088 BLAKE2B 5af4dc008775c7d7958fc03df3800855685d00af7312f024a966948bd85522d40f357288deb4f13281dc93ace1b08cf40edf0b4c573dcba789887e86b45ce6ed SHA512 059082e5ce052189ed0c36ee97d7295f88cbb9e20dcb5677565a65d60cba11ff969d4382b6c6a69b8d6255da7274c205cf5c167fe76a24db3b9765f1633a9962
+DIST glibc-2.31-patches-8.tar.xz 60868 BLAKE2B c641a77cab0b3e5379a6911a548483266110d747300f6bd4c138754cc35aff266088be8682ba45ac105c946ee309db0bc094b0c3bc48fd4303c925a7594e17e2 SHA512 1bc069d487ff9d4cd33c5d293bb0789114f65af5179b3d9df8ff0a9f043d5ffbcd030d8eabc90b329c896dfdd0409c4b8dac371eafdd380ecc660b9540320637
 DIST glibc-2.31-sparc-patch1-reg-kabi.patch 8525 BLAKE2B 2600ba4b0e24df2054a6e77ef79b6e5312e5594714d78015c4a949bb2c9b29c9535121bed9d633215710f6f50525fa0d2864aea43abbfeae281a6cc3dab71e5d SHA512 8dab29ea2e9e809806df17f3b707e7be27ac37121d0e3c6ee52fd41c1d6891bf71c0d8c154593754531aee96f8c866e06646f149c8bdd602521b703471d56bd2
 DIST glibc-2.31-sparc-patch2-reg-fix-clobber.patch 6864 BLAKE2B a39a10ff204d74289278125d7f2686db01874e998cb27b46b3b8b9597b5a2eae3b975a5ab08a8f5dd83693455891f6862b6eb70654f215c2ce6c5da222be96a1 SHA512 69bba011a30177386193ac4ac14a4e731c45b12dbb3745619ee802459aa75d6bbd37e62e979ec9790f691edb5f9077d37ee668b8df406f8f1c4d4316ef8c0aa7
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306

diff --git a/sys-libs/glibc/glibc-2.31-r6.ebuild b/sys-libs/glibc/glibc-2.31-r6.ebuild
new file mode 100644
index 00000000000..184a4789036
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.31-r6.ebuild
@@ -0,0 +1,1493 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=8
+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"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+LOCALE_GEN_VER=2.00
+
+SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+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"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		ia64)
+			# Workaround GPREL22 overflow by slightly pessimizing global
+			# references to go via 64-bit relocations instead of 22-bit ones.
+			# This allows building glibc on ia64 without an overflow: #723268
+			append-flags -fcommon
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && 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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+}
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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
+		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 )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins posix/gai.conf nss/nsswitch.conf
+
+	# Gentoo-specific
+	newins "${FILESDIR}"/host.conf-1 host.conf
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-07-18 16:58 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-07-18 16:58 UTC (permalink / raw
  To: gentoo-commits

commit:     d99ab81692f0f04aa1421087c970ffd360163962
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 18 16:58:28 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Jul 18 16:58:28 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d99ab816

sys-libs/glibc: drop -fcommon on ia64 (fixed in code)

Glibc patchset now contains 0100-Fix-miscompilation-on-ia64-s-gcc-10.patch
to workaround invalid relocation on ia64.

Bug: https://bugs.gentoo.org/723268
Package-Manager: Portage-2.3.103, Repoman-2.3.23
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r6.ebuild | 6 ------
 sys-libs/glibc/glibc-9999.ebuild    | 6 ------
 2 files changed, 12 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.31-r6.ebuild b/sys-libs/glibc/glibc-2.31-r6.ebuild
index 184a4789036..e4afc3b424e 100644
--- a/sys-libs/glibc/glibc-2.31-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r6.ebuild
@@ -297,12 +297,6 @@ setup_target_flags() {
 				einfo "Auto adding -march=${t} to CFLAGS_x86 #185404 (ABI=${ABI})"
 			fi
 		;;
-		ia64)
-			# Workaround GPREL22 overflow by slightly pessimizing global
-			# references to go via 64-bit relocations instead of 22-bit ones.
-			# This allows building glibc on ia64 without an overflow: #723268
-			append-flags -fcommon
-		;;
 		mips)
 			# The mips abi cannot support the GNU style hashes. #233233
 			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ca5f697b063..df9c8b6a44d 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -298,12 +298,6 @@ setup_target_flags() {
 				einfo "Auto adding -march=${t} to CFLAGS_x86 #185404 (ABI=${ABI})"
 			fi
 		;;
-		ia64)
-			# Workaround GPREL22 overflow by slightly pessimizing global
-			# references to go via 64-bit relocations instead of 22-bit ones.
-			# This allows building glibc on ia64 without an overflow: #723268
-			append-flags -fcommon
-		;;
 		mips)
 			# The mips abi cannot support the GNU style hashes. #233233
 			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-07-25 22:11 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-07-25 22:11 UTC (permalink / raw
  To: gentoo-commits

commit:     ce7871b54de4df832bb12c918a0967090a537cca
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 25 22:11:10 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jul 25 22:11:46 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ce7871b5

sys-libs/glibc: remove old

Package-Manager: Portage-2.3.103, Repoman-2.3.23
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    4 -
 sys-libs/glibc/glibc-2.31-r4.ebuild | 1486 ----------------------------------
 sys-libs/glibc/glibc-2.31-r5.ebuild | 1493 -----------------------------------
 3 files changed, 2983 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 48815d21618..ff872d24dc1 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -7,10 +7,6 @@ DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1
 DIST glibc-2.30-patches-10.tar.xz 72808 BLAKE2B a7a95c99482524b2896d15539766f1e6b1fe34a22f32119248c6dd44f42632076e86fdcbbdc2d604ec73ceccdd8a7f5936a62a6f4c3d039fae8f6901dfc6be77 SHA512 af5e213ff08bf38f6f529816c36b4e38df27207c2df254609ebe45b2f039ab553bbe563aa6f64b6667d328fd2c120dc21b6e2676540bdd94e58079237089eac3
 DIST glibc-2.30-sparc-reg-fix-clobber.patch 6106 BLAKE2B cad6a4cbef5d529519ef486f4ef8e189cb4d43dd67fa8f8d50d67072cbb682f60474d482a5c5152d1317de92b98851d8a88eee6b331eb5bc22de065c03c58fde SHA512 a018ef1f196257f3888af20a5cbc97892c8382a4f489da042568e087c077f30cf4dda6ac711b573e1274317866ce97cf817d92a28cf55f18f5e8d32787e6cb3f
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
-DIST glibc-2.31-patches-5.tar.xz 52720 BLAKE2B 0e4315a79d4108e8a0eb2d849086de40a3ddebd9c09592ec5ecd02d9a0481f58588d7fca345624b0e345b077f6f3ad4257fb5949a0f05be2a004489af585a329 SHA512 c081aef22efacac19ce343ad6e55b8102869c42142dfd478e1cc03e85d6569771b52b737173df0996e273dc6ad1e8dea391658e03d5bcb69f2ed754801b3f6fa
-DIST glibc-2.31-patches-7.tar.xz 56088 BLAKE2B 5af4dc008775c7d7958fc03df3800855685d00af7312f024a966948bd85522d40f357288deb4f13281dc93ace1b08cf40edf0b4c573dcba789887e86b45ce6ed SHA512 059082e5ce052189ed0c36ee97d7295f88cbb9e20dcb5677565a65d60cba11ff969d4382b6c6a69b8d6255da7274c205cf5c167fe76a24db3b9765f1633a9962
 DIST glibc-2.31-patches-8.tar.xz 60868 BLAKE2B c641a77cab0b3e5379a6911a548483266110d747300f6bd4c138754cc35aff266088be8682ba45ac105c946ee309db0bc094b0c3bc48fd4303c925a7594e17e2 SHA512 1bc069d487ff9d4cd33c5d293bb0789114f65af5179b3d9df8ff0a9f043d5ffbcd030d8eabc90b329c896dfdd0409c4b8dac371eafdd380ecc660b9540320637
-DIST glibc-2.31-sparc-patch1-reg-kabi.patch 8525 BLAKE2B 2600ba4b0e24df2054a6e77ef79b6e5312e5594714d78015c4a949bb2c9b29c9535121bed9d633215710f6f50525fa0d2864aea43abbfeae281a6cc3dab71e5d SHA512 8dab29ea2e9e809806df17f3b707e7be27ac37121d0e3c6ee52fd41c1d6891bf71c0d8c154593754531aee96f8c866e06646f149c8bdd602521b703471d56bd2
-DIST glibc-2.31-sparc-patch2-reg-fix-clobber.patch 6864 BLAKE2B a39a10ff204d74289278125d7f2686db01874e998cb27b46b3b8b9597b5a2eae3b975a5ab08a8f5dd83693455891f6862b6eb70654f215c2ce6c5da222be96a1 SHA512 69bba011a30177386193ac4ac14a4e731c45b12dbb3745619ee802459aa75d6bbd37e62e979ec9790f691edb5f9077d37ee668b8df406f8f1c4d4316ef8c0aa7
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff

diff --git a/sys-libs/glibc/glibc-2.31-r4.ebuild b/sys-libs/glibc/glibc-2.31-r4.ebuild
deleted file mode 100644
index f4831ba151d..00000000000
--- a/sys-libs/glibc/glibc-2.31-r4.ebuild
+++ /dev/null
@@ -1,1486 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7,8} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	# needs minimal testing
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-LOCALE_GEN_VER=2.00
-
-# Gentoo patchset
-PATCH_VER=5
-PATCH_DEV=dilfridge
-
-SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-SRC_URI+="
-	https://dev.gentoo.org/~slyfox/distfiles/glibc-2.31-sparc-patch1-reg-kabi.patch
-	https://dev.gentoo.org/~slyfox/distfiles/glibc-2.31-sparc-patch2-reg-fix-clobber.patch
-"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		ia64)
-			# Workaround GPREL22 overflow by slightly pessimizing global
-			# references to go via 64-bit relocations instead of 22-bit ones.
-			# This allows building glibc on ia64 without an overflow: #723268
-			append-flags -fcommon
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-
-	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		eapply "${DISTDIR}"/glibc-2.31-sparc-patch1-reg-kabi.patch
-		eapply "${DISTDIR}"/glibc-2.31-sparc-patch2-reg-fix-clobber.patch
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins posix/gai.conf nss/nsswitch.conf
-
-	# Gentoo-specific
-	newins "${FILESDIR}"/host.conf-1 host.conf
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.31-r5.ebuild b/sys-libs/glibc/glibc-2.31-r5.ebuild
deleted file mode 100644
index 897a2582eb9..00000000000
--- a/sys-libs/glibc/glibc-2.31-r5.ebuild
+++ /dev/null
@@ -1,1493 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7,8} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=7
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-LOCALE_GEN_VER=2.00
-
-SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		ia64)
-			# Workaround GPREL22 overflow by slightly pessimizing global
-			# references to go via 64-bit relocations instead of 22-bit ones.
-			# This allows building glibc on ia64 without an overflow: #723268
-			append-flags -fcommon
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && 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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
-}
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins posix/gai.conf nss/nsswitch.conf
-
-	# Gentoo-specific
-	newins "${FILESDIR}"/host.conf-1 host.conf
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-07-27 15:41 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-07-27 15:41 UTC (permalink / raw
  To: gentoo-commits

commit:     02362f4a1a9bfb69ef80d3156c3e34db3d522dad
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 27 15:41:19 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jul 27 15:41:44 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=02362f4a

sys-libs/glibc: Bump locale-gen version

Package-Manager: Portage-2.3.103, Repoman-2.3.23
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 1 +
 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index ff872d24dc1..c523261945b 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -10,3 +10,4 @@ DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811
 DIST glibc-2.31-patches-8.tar.xz 60868 BLAKE2B c641a77cab0b3e5379a6911a548483266110d747300f6bd4c138754cc35aff266088be8682ba45ac105c946ee309db0bc094b0c3bc48fd4303c925a7594e17e2 SHA512 1bc069d487ff9d4cd33c5d293bb0789114f65af5179b3d9df8ff0a9f043d5ffbcd030d8eabc90b329c896dfdd0409c4b8dac371eafdd380ecc660b9540320637
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff
+DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index df9c8b6a44d..11c976c8473 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -32,7 +32,7 @@ RELEASE_VER=${PV}
 
 GCC_BOOTSTRAP_VER=20180511
 
-LOCALE_GEN_VER=2.00
+LOCALE_GEN_VER=2.10
 
 SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-08-03 17:58 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-08-03 17:58 UTC (permalink / raw
  To: gentoo-commits

commit:     ee8d751d6ab6a477c59e8d0ebb2c02207c795e59
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  3 17:23:52 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug  3 17:58:12 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee8d751d

sys-libs/glibc: arm64 stable (bug #727758)

Package-Manager: Portage-3.0.1, Repoman-2.3.23
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r9.ebuild | 2 +-
 sys-libs/glibc/glibc-2.31-r6.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30-r9.ebuild b/sys-libs/glibc/glibc-2.30-r9.ebuild
index 11a2b4d878c..aea47e4d621 100644
--- a/sys-libs/glibc/glibc-2.30-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r9.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 

diff --git a/sys-libs/glibc/glibc-2.31-r6.ebuild b/sys-libs/glibc/glibc-2.31-r6.ebuild
index e4afc3b424e..d7bac6d5920 100644
--- a/sys-libs/glibc/glibc-2.31-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r6.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-08-04 15:11 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-08-04 15:11 UTC (permalink / raw
  To: gentoo-commits

commit:     a6938d1e8636463907bf0e3c144ab11884a76c7a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  4 15:03:57 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Aug  4 15:10:53 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6938d1e

sys-libs/glibc: arm stable (bug #727758)

Package-Manager: Portage-3.0.1, Repoman-2.3.23
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r9.ebuild | 2 +-
 sys-libs/glibc/glibc-2.31-r6.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30-r9.ebuild b/sys-libs/glibc/glibc-2.30-r9.ebuild
index aea47e4d621..71fbad018a6 100644
--- a/sys-libs/glibc/glibc-2.30-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r9.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 

diff --git a/sys-libs/glibc/glibc-2.31-r6.ebuild b/sys-libs/glibc/glibc-2.31-r6.ebuild
index d7bac6d5920..5c7938218b0 100644
--- a/sys-libs/glibc/glibc-2.31-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r6.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-08-06 10:28 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-08-06 10:28 UTC (permalink / raw
  To: gentoo-commits

commit:     73cfdbaf6bdd4c429456f4f6c36ead0039bbfa1b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  6 10:28:07 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Aug  6 10:28:36 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=73cfdbaf

sys-libs/glibc: Version bump (no keywords)

Package-Manager: Portage-2.3.103, Repoman-2.3.23
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          |    2 +
 sys-libs/glibc/glibc-2.32.ebuild | 1488 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 1490 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index c523261945b..18fd364edc4 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -9,5 +9,7 @@ DIST glibc-2.30-sparc-reg-fix-clobber.patch 6106 BLAKE2B cad6a4cbef5d529519ef486
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-8.tar.xz 60868 BLAKE2B c641a77cab0b3e5379a6911a548483266110d747300f6bd4c138754cc35aff266088be8682ba45ac105c946ee309db0bc094b0c3bc48fd4303c925a7594e17e2 SHA512 1bc069d487ff9d4cd33c5d293bb0789114f65af5179b3d9df8ff0a9f043d5ffbcd030d8eabc90b329c896dfdd0409c4b8dac371eafdd380ecc660b9540320637
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
+DIST glibc-2.32-patches-1.tar.xz 7640 BLAKE2B 849bdc1108e1f68f307bb9673f5ecda7c5470815f7d2de7956d529b638aafd4a8f37c22f79bc89d8e5f2efd51878927d3999d80586ec1074c46a52b6e148ea18 SHA512 a206d69693c3d9c527e17307b413aed05bcdefdf2537bb16af97ef31e85e4c48812971b60c00107b6a7c4bdc83c7e8ba1c9ea96f5641520852f98928f1018349
+DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff
 DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db

diff --git a/sys-libs/glibc/glibc-2.32.ebuild b/sys-libs/glibc/glibc-2.32.ebuild
new file mode 100644
index 00000000000..f3d4d7154f2
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.32.ebuild
@@ -0,0 +1,1488 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=1
+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=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+LOCALE_GEN_VER=2.10
+
+SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+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"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && 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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+}
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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
+		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 )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins posix/gai.conf nss/nsswitch.conf
+
+	# Gentoo-specific
+	newins "${FILESDIR}"/host.conf-1 host.conf
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-08-10 16:43 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2020-08-10 16:43 UTC (permalink / raw
  To: gentoo-commits

commit:     c02c1e1103e9ed1159cf4e4b4c2bac1954a3c00d
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 10 16:42:42 2020 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Mon Aug 10 16:42:42 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c02c1e11

sys-libs/glibc: amd64 stable wrt bug #727758

Package-Manager: Portage-2.3.103, Repoman-2.3.23
RepoMan-Options: --include-arches="amd64"
Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r9.ebuild | 2 +-
 sys-libs/glibc/glibc-2.31-r6.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30-r9.ebuild b/sys-libs/glibc/glibc-2.30-r9.ebuild
index 71fbad018a6..461c4459000 100644
--- a/sys-libs/glibc/glibc-2.30-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r9.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 

diff --git a/sys-libs/glibc/glibc-2.31-r6.ebuild b/sys-libs/glibc/glibc-2.31-r6.ebuild
index 5c7938218b0..d38fbf49f66 100644
--- a/sys-libs/glibc/glibc-2.31-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r6.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-08-11 17:02 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-08-11 17:02 UTC (permalink / raw
  To: gentoo-commits

commit:     350e0ef1e4cf2ebabf7743ffb748f07c02aae355
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Tue Aug 11 10:54:49 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Aug 11 17:02:34 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=350e0ef1

sys-libs/glibc: stable 2.30-r9 for hppa, bug #727758

Package-Manager: Portage-2.3.103, Repoman-2.3.23
RepoMan-Options: --include-arches="hppa"
Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.30-r9.ebuild b/sys-libs/glibc/glibc-2.30-r9.ebuild
index 461c4459000..34487040662 100644
--- a/sys-libs/glibc/glibc-2.30-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r9.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-08-11 17:02 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-08-11 17:02 UTC (permalink / raw
  To: gentoo-commits

commit:     30d0183609fb35061db1e792af2c1bbef3302715
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Tue Aug 11 10:55:34 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Aug 11 17:02:38 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=30d01836

sys-libs/glibc: stable 2.31-r6 for hppa, bug #727758

Package-Manager: Portage-2.3.103, Repoman-2.3.23
RepoMan-Options: --include-arches="hppa"
Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.31-r6.ebuild b/sys-libs/glibc/glibc-2.31-r6.ebuild
index d38fbf49f66..326b60a6565 100644
--- a/sys-libs/glibc/glibc-2.31-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r6.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-08-11 22:29 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-08-11 22:29 UTC (permalink / raw
  To: gentoo-commits

commit:     d7d932d5966bf3c9fe5f7c32e7fb667954ca1c68
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 11 22:28:41 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Aug 11 22:28:41 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d7d932d5

sys-libs/glibc: Stabilize 2.31-r6 sparc, #727758

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.31-r6.ebuild b/sys-libs/glibc/glibc-2.31-r6.ebuild
index 326b60a6565..d6dfb53de7e 100644
--- a/sys-libs/glibc/glibc-2.31-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r6.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-08-12  7:38 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-08-12  7:38 UTC (permalink / raw
  To: gentoo-commits

commit:     ce726e906a4431599a004681d3d5b94ea3100230
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 12 07:37:37 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Aug 12 07:37:37 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ce726e90

sys-libs/glibc: Stabilize 2.31-r6 x86, #727758

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.31-r6.ebuild b/sys-libs/glibc/glibc-2.31-r6.ebuild
index d6dfb53de7e..c010b578953 100644
--- a/sys-libs/glibc/glibc-2.31-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r6.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-08-12  7:38 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-08-12  7:38 UTC (permalink / raw
  To: gentoo-commits

commit:     076f624a04824b44fee83435e76073915f5f4fb0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 12 07:37:36 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Aug 12 07:37:36 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=076f624a

sys-libs/glibc: Stabilize 2.30-r9 x86, #727758

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.30-r9.ebuild b/sys-libs/glibc/glibc-2.30-r9.ebuild
index 34487040662..2a22b0bde8e 100644
--- a/sys-libs/glibc/glibc-2.30-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r9.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-08-14  8:08 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-08-14  8:08 UTC (permalink / raw
  To: gentoo-commits

commit:     6d10e48657996db8ddc984e577bae6a9d4fe3279
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 14 08:07:51 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Aug 14 08:07:51 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d10e486

sys-libs/glibc: Add keywords to 2.32

Bug: https://bugs.gentoo.org/736174
Package-Manager: Portage-2.3.103, Repoman-2.3.23
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.32.ebuild b/sys-libs/glibc/glibc-2.32.ebuild
index f3d4d7154f2..2a750041ae4 100644
--- a/sys-libs/glibc/glibc-2.32.ebuild
+++ b/sys-libs/glibc/glibc-2.32.ebuild
@@ -22,8 +22,7 @@ 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=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-08-23 10:19 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-08-23 10:19 UTC (permalink / raw
  To: gentoo-commits

commit:     85e4daddaa23c9e06541da69d51bec9bd58f7608
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 23 10:06:45 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Aug 23 10:19:16 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=85e4dadd

sys-libs/glibc: reenable stack protection on powerpc-*

Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 11c976c8473..ef9ad2c0051 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -839,14 +839,6 @@ glibc_do_configure() {
 			# https://sourceware.org/PR24202
 			myconf+=( --enable-stack-protector=no )
 			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			myconf+=( --enable-stack-protector=no )
-			;;
 		*)
 			# Use '=strong' instead of '=all' to protect only functions
 			# worth protecting from stack smashes.


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-08-23 10:19 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-08-23 10:19 UTC (permalink / raw
  To: gentoo-commits

commit:     3e3d3f661fa3df6911db31e7496951aa23497389
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 23 10:19:03 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Aug 23 10:19:16 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3e3d3f66

sys-libs/glibc: disable multiarch on ppc32

By default glibc does not enable multiarch on
powerpc-unknown-linux-gnu targets.

Bug triggers only when CFLAGS= enables power4
or above (like, CFLAGS=-mcpu=7450).

multiarch does not work on ppc with cache-block not equal to
128 bytes and breaks memset implementations. There 'dcbz'
instruction is used for optimization to zero out cache-block
with zeros at a time. memset implementation assumes
cache-block=128.

G4 hardware and qemu-ppc both have cache-block=32.

This means memset() zero-initializes only 32 of each 128-byte
block including .sbss and .bss sections. This breaks glibc's
locks and many other things.

The change disables multiarch for pps32 in Gentoo until
glibc is fixed upstream.

Reported-by: Daniel Gurney
Bug: https://sourceware.org/PR26522
Closes:https://bugs.gentoo.org/737996

Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r6.ebuild | 5 +++++
 sys-libs/glibc/glibc-2.32.ebuild    | 5 +++++
 sys-libs/glibc/glibc-9999.ebuild    | 5 +++++
 3 files changed, 15 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.31-r6.ebuild b/sys-libs/glibc/glibc-2.31-r6.ebuild
index c010b578953..73a26abf452 100644
--- a/sys-libs/glibc/glibc-2.31-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r6.ebuild
@@ -420,6 +420,11 @@ want__thread() {
 use_multiarch() {
 	# Allow user to disable runtime arch detection in multilib.
 	use multiarch || return 1
+	# multiarch does not work on ppc with cache-block not equal to 128 bytes
+	# and breaks memset:
+	# https://sourceware.org/PR26522
+	# https://bugs.gentoo.org/737996
+	[[ $(tc-arch ${CTARGET}) == ppc ]] && return 1
 	# Make sure binutils is new enough to support indirect functions,
 	# #336792. This funky sed supports gold and bfd linkers.
 	local bver nver

diff --git a/sys-libs/glibc/glibc-2.32.ebuild b/sys-libs/glibc/glibc-2.32.ebuild
index 2a750041ae4..a53946fa562 100644
--- a/sys-libs/glibc/glibc-2.32.ebuild
+++ b/sys-libs/glibc/glibc-2.32.ebuild
@@ -420,6 +420,11 @@ want__thread() {
 use_multiarch() {
 	# Allow user to disable runtime arch detection in multilib.
 	use multiarch || return 1
+	# multiarch does not work on ppc with cache-block not equal to 128 bytes
+	# and breaks memset:
+	# https://sourceware.org/PR26522
+	# https://bugs.gentoo.org/737996
+	[[ $(tc-arch ${CTARGET}) == ppc ]] && return 1
 	# Make sure binutils is new enough to support indirect functions,
 	# #336792. This funky sed supports gold and bfd linkers.
 	local bver nver

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ef9ad2c0051..8430fbb242d 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -421,6 +421,11 @@ want__thread() {
 use_multiarch() {
 	# Allow user to disable runtime arch detection in multilib.
 	use multiarch || return 1
+	# multiarch does not work on ppc with cache-block not equal to 128 bytes
+	# and breaks memset:
+	# https://sourceware.org/PR26522
+	# https://bugs.gentoo.org/737996
+	[[ $(tc-arch ${CTARGET}) == ppc ]] && return 1
 	# Make sure binutils is new enough to support indirect functions,
 	# #336792. This funky sed supports gold and bfd linkers.
 	local bver nver


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-08-23 10:47 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-08-23 10:47 UTC (permalink / raw
  To: gentoo-commits

commit:     81b4106ebd12af6e3fc6ec488c6dd8d07a2344d3
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 23 10:45:19 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Aug 23 10:47:09 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=81b4106e

sys-libs/glibc: revert "disable multiarch on ppc32"

Disabling multiarch is not enough as static -mcpu=
selection will still attempt to close best fit
implementation (as opposed to refault C-based
implementation). And these still don't work.

This reverts commit 3e3d3f661fa3df6911db31e7496951aa23497389.

Bug: https://bugs.gentoo.org/737996
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r6.ebuild | 5 -----
 sys-libs/glibc/glibc-2.32.ebuild    | 5 -----
 sys-libs/glibc/glibc-9999.ebuild    | 5 -----
 3 files changed, 15 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.31-r6.ebuild b/sys-libs/glibc/glibc-2.31-r6.ebuild
index 73a26abf452..c010b578953 100644
--- a/sys-libs/glibc/glibc-2.31-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r6.ebuild
@@ -420,11 +420,6 @@ want__thread() {
 use_multiarch() {
 	# Allow user to disable runtime arch detection in multilib.
 	use multiarch || return 1
-	# multiarch does not work on ppc with cache-block not equal to 128 bytes
-	# and breaks memset:
-	# https://sourceware.org/PR26522
-	# https://bugs.gentoo.org/737996
-	[[ $(tc-arch ${CTARGET}) == ppc ]] && return 1
 	# Make sure binutils is new enough to support indirect functions,
 	# #336792. This funky sed supports gold and bfd linkers.
 	local bver nver

diff --git a/sys-libs/glibc/glibc-2.32.ebuild b/sys-libs/glibc/glibc-2.32.ebuild
index a53946fa562..2a750041ae4 100644
--- a/sys-libs/glibc/glibc-2.32.ebuild
+++ b/sys-libs/glibc/glibc-2.32.ebuild
@@ -420,11 +420,6 @@ want__thread() {
 use_multiarch() {
 	# Allow user to disable runtime arch detection in multilib.
 	use multiarch || return 1
-	# multiarch does not work on ppc with cache-block not equal to 128 bytes
-	# and breaks memset:
-	# https://sourceware.org/PR26522
-	# https://bugs.gentoo.org/737996
-	[[ $(tc-arch ${CTARGET}) == ppc ]] && return 1
 	# Make sure binutils is new enough to support indirect functions,
 	# #336792. This funky sed supports gold and bfd linkers.
 	local bver nver

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 8430fbb242d..ef9ad2c0051 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -421,11 +421,6 @@ want__thread() {
 use_multiarch() {
 	# Allow user to disable runtime arch detection in multilib.
 	use multiarch || return 1
-	# multiarch does not work on ppc with cache-block not equal to 128 bytes
-	# and breaks memset:
-	# https://sourceware.org/PR26522
-	# https://bugs.gentoo.org/737996
-	[[ $(tc-arch ${CTARGET}) == ppc ]] && return 1
 	# Make sure binutils is new enough to support indirect functions,
 	# #336792. This funky sed supports gold and bfd linkers.
 	local bver nver


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-08-23 11:33 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-08-23 11:33 UTC (permalink / raw
  To: gentoo-commits

commit:     8cf656db6d13ce7e97966bb31c0a068731f8530e
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 23 11:32:05 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Aug 23 11:33:01 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8cf656db

sys-libs/glibc: disable submachine detection on ppc32

By default glibc does not enable multiarch on
powerpc-unknown-linux-gnu targets.

Bug triggers only when CFLAGS value enables power4
or above (like, CFLAGS=-mcpu=7450).

multiarch does not work on ppc with cache-block not equal to
128 bytes and breaks memset implementations. There 'dcbz'
instruction is used for optimization to zero out cache-block
with zeros at a time. memset implementation assumes
cache-block=128.

G4 hardware and qemu-ppc both have cache-block=32.

This means memset() zero-initializes only 32 of each 128-byte
block including .sbss and .bss sections. This breaks glibc's
locks and many other things.

The change disables submachine detection for ppc32 in Gentoo
until glibc is fixed upstream.

Reported-by: Daniel Gurney
Bug: https://sourceware.org/PR26522
Closes:https://bugs.gentoo.org/737996

Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r6.ebuild | 8 ++++++++
 sys-libs/glibc/glibc-2.32.ebuild    | 8 ++++++++
 sys-libs/glibc/glibc-9999.ebuild    | 8 ++++++++
 3 files changed, 24 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.31-r6.ebuild b/sys-libs/glibc/glibc-2.31-r6.ebuild
index c010b578953..3ac5fb0e9b1 100644
--- a/sys-libs/glibc/glibc-2.31-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r6.ebuild
@@ -301,6 +301,14 @@ setup_target_flags() {
 			# The mips abi cannot support the GNU style hashes. #233233
 			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
 		;;
+		ppc)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
 		sparc)
 			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
 			filter-flags "-fcall-used-g7"

diff --git a/sys-libs/glibc/glibc-2.32.ebuild b/sys-libs/glibc/glibc-2.32.ebuild
index 2a750041ae4..062f5445621 100644
--- a/sys-libs/glibc/glibc-2.32.ebuild
+++ b/sys-libs/glibc/glibc-2.32.ebuild
@@ -301,6 +301,14 @@ setup_target_flags() {
 			# The mips abi cannot support the GNU style hashes. #233233
 			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
 		;;
+		ppc)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
 		sparc)
 			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
 			filter-flags "-fcall-used-g7"

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ef9ad2c0051..67b4c124000 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -302,6 +302,14 @@ setup_target_flags() {
 			# The mips abi cannot support the GNU style hashes. #233233
 			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
 		;;
+		ppc)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
 		sparc)
 			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
 			filter-flags "-fcall-used-g7"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-08-31  8:30 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-08-31  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     1a7722c9ca951bc1ce3a73e0c40b93348f8e26ef
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 31 08:30:02 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Aug 31 08:30:30 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1a7722c9

sys-libs/glibc: Add rv32 backport

Package-Manager: Portage-2.3.103, Repoman-2.3.23
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.32-r1.ebuild | 1503 +++++++++++++++++++++++++++++++++++
 2 files changed, 1504 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 18fd364edc4..5066a2b1830 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -1,3 +1,4 @@
+DIST backport-rv32.txz 26416 BLAKE2B 7a6b593859f88a3c040f06324dace4cc6137d14d4580fad9ea285829666d761c3dd01c190746e86846c219423124c77a55bc57b6e56efe6401a9c99d7fa445cd SHA512 d08dc02c4f0a3c5a15c57fbb5190588121c0e0728e6ab2119483407a98625efe58b3c83b44d750b0146171e63dcf8a6dbb6d1a057d042f794eed9adbd1f0293e
 DIST gcc-4.7.3-r1-multilib-bootstrap.tar.bz2 8064097 BLAKE2B 3cc5c82cd57d0fbd26d9a376ee8ca02f119fe9d653311cbe4d2b7b93aec2290adac3be271be19a7fdedae2e11e4b6e32360184e557204e100ad64357f5575d4b SHA512 40b93e194ad41a75d649d84d1c49070680f253a13f0617803243bc61c44fed1ca2d0a7572a97ebb79353f312b58b5f6360be916dd7435928cc53935082e15269
 DIST gcc-multilib-bootstrap-20180511.tar.xz 2392908 BLAKE2B f3cf614399368acd8908f60d894c6344a2fa09383b30c1633a0682bc668367c8a2f8c6fec2d41b6e2178d709a2bd8db57e8b2ab56ba263c7d56f819c15acd061 SHA512 98c766e913693ab42ff790557acde2a36a8001e2648046a685b21964200df8d4d52d8452d499c0068c6648284d086ce062c2d36e2c6c2fd8aacd232d193f2853
 DIST glibc-2.19-patches-9.tar.bz2 24584 BLAKE2B a96e930a5bd20fa75d9f259cc2117fa5ce98072274a24a5823bf877e3739fa4c001a94d7865e065ee0527f3974430d27da8038e042340a451ad2052c62724f26 SHA512 a95b3063ade974a3556480b798b317d33c7423a8cb9e69f67249ffb8b3d3c671d70d2d5f782c1efadc0bec4cc49a96d4fe89911f3dfcd85b459f69f3b4f38f0e

diff --git a/sys-libs/glibc/glibc-2.32-r1.ebuild b/sys-libs/glibc/glibc-2.32-r1.ebuild
new file mode 100644
index 00000000000..a383a881f50
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.32-r1.ebuild
@@ -0,0 +1,1503 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=1
+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"
+	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+LOCALE_GEN_VER=2.10
+
+SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+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"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && 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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+	use riscv && unpack backport-rv32.txz
+}
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+
+		if use riscv ; then
+			elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
+			eapply "${WORKDIR}"/backport-rv32
+			einfo "Done."
+		fi
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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
+		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 )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins posix/gai.conf nss/nsswitch.conf
+
+	# Gentoo-specific
+	newins "${FILESDIR}"/host.conf-1 host.conf
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-09-01 22:26 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-09-01 22:26 UTC (permalink / raw
  To: gentoo-commits

commit:     c4a7f6ae0192ceee9412ee15e5d9001dd0e56f09
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Sep  1 22:25:34 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Sep  1 22:26:07 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4a7f6ae

sys-libs/glibc: Add rv32 linker locations

Package-Manager: Portage-2.3.103, Repoman-2.3.23
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r1.ebuild | 2 ++
 sys-libs/glibc/glibc-9999.ebuild    | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.32-r1.ebuild b/sys-libs/glibc/glibc-2.32-r1.ebuild
index a383a881f50..b51024529ad 100644
--- a/sys-libs/glibc/glibc-2.32-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r1.ebuild
@@ -1251,6 +1251,8 @@ glibc_do_src_install() {
 		ppc     /lib/ld.so.1
 		ppc64   /lib64/ld64.so.1
 		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
 		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
 		lp64    /lib/ld-linux-riscv64-lp64.so.1
 		# s390

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 67b4c124000..13ff94e526a 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1236,6 +1236,8 @@ glibc_do_src_install() {
 		ppc     /lib/ld.so.1
 		ppc64   /lib64/ld64.so.1
 		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
 		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
 		lp64    /lib/ld-linux-riscv64-lp64.so.1
 		# s390


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-09-05  2:46 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-09-05  2:46 UTC (permalink / raw
  To: gentoo-commits

commit:     3acb1697fbdb842072d5573ff68112486f59e5ad
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  5 02:43:04 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 02:46:00 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3acb1697

sys-libs/glibc: 2.31 revbump, patchlevel 9

Untested, no keywords for now

Bug: https://bugs.gentoo.org/736904
Package-Manager: Portage-3.0.4, Repoman-2.3.23
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.31-r7.ebuild | 1495 +++++++++++++++++++++++++++++++++++
 2 files changed, 1496 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 5066a2b1830..18bbbabeaa1 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -9,6 +9,7 @@ DIST glibc-2.30-patches-10.tar.xz 72808 BLAKE2B a7a95c99482524b2896d15539766f1e6
 DIST glibc-2.30-sparc-reg-fix-clobber.patch 6106 BLAKE2B cad6a4cbef5d529519ef486f4ef8e189cb4d43dd67fa8f8d50d67072cbb682f60474d482a5c5152d1317de92b98851d8a88eee6b331eb5bc22de065c03c58fde SHA512 a018ef1f196257f3888af20a5cbc97892c8382a4f489da042568e087c077f30cf4dda6ac711b573e1274317866ce97cf817d92a28cf55f18f5e8d32787e6cb3f
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-8.tar.xz 60868 BLAKE2B c641a77cab0b3e5379a6911a548483266110d747300f6bd4c138754cc35aff266088be8682ba45ac105c946ee309db0bc094b0c3bc48fd4303c925a7594e17e2 SHA512 1bc069d487ff9d4cd33c5d293bb0789114f65af5179b3d9df8ff0a9f043d5ffbcd030d8eabc90b329c896dfdd0409c4b8dac371eafdd380ecc660b9540320637
+DIST glibc-2.31-patches-9.tar.xz 74712 BLAKE2B 62991b67de4def4cca944e8420d2f0139f88b6754c6bc81072bb321c574c1db22641857345325848e1dfb551c10758f582e4425e687a7921cdbd4e7e7923a047 SHA512 699d898e3a8ed02b04573c675f572076e8f747767bfc577a033a49cd7d9078a7a60ac325acd4bd419a93b56edf90ce067baa7578ab315e27885f1f0e13916354
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-2.32-patches-1.tar.xz 7640 BLAKE2B 849bdc1108e1f68f307bb9673f5ecda7c5470815f7d2de7956d529b638aafd4a8f37c22f79bc89d8e5f2efd51878927d3999d80586ec1074c46a52b6e148ea18 SHA512 a206d69693c3d9c527e17307b413aed05bcdefdf2537bb16af97ef31e85e4c48812971b60c00107b6a7c4bdc83c7e8ba1c9ea96f5641520852f98928f1018349
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
new file mode 100644
index 00000000000..91c98436a19
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -0,0 +1,1495 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=9
+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"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+LOCALE_GEN_VER=2.00
+
+SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+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"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && 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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+}
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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
+		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 )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins posix/gai.conf nss/nsswitch.conf
+
+	# Gentoo-specific
+	newins "${FILESDIR}"/host.conf-1 host.conf
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-09-05  2:46 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-09-05  2:46 UTC (permalink / raw
  To: gentoo-commits

commit:     a227fbc0538d8ebf90125b822923dea69c4ede70
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  5 02:35:35 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 02:45:56 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a227fbc0

sys-libs/glibc: Needs binutils 2.27 to build now

Package-Manager: Portage-3.0.4, Repoman-2.3.23
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 13ff94e526a..2319a1e0342 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -117,13 +117,13 @@ RESTRICT="!test? ( test )"
 
 if [[ ${CATEGORY} == cross-* ]] ; then
 	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/binutils-2.27
 		>=${CATEGORY}/gcc-6
 	)"
 	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
 else
 	BDEPEND+="
-		>=sys-devel/binutils-2.24
+		>=sys-devel/binutils-2.27
 		>=sys-devel/gcc-6
 	"
 	DEPEND+=" virtual/os-headers "


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-09-06  4:11 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-09-06  4:11 UTC (permalink / raw
  To: gentoo-commits

commit:     605bfbb35ba64f2d7d4c4b53b48b9300a116c657
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  6 03:36:14 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Sep  6 03:36:14 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=605bfbb3

sys-libs/glibc: ppc stable (bug #727758)

Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r9.ebuild | 2 +-
 sys-libs/glibc/glibc-2.31-r6.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30-r9.ebuild b/sys-libs/glibc/glibc-2.30-r9.ebuild
index 2a22b0bde8e..a1cce5253c2 100644
--- a/sys-libs/glibc/glibc-2.30-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r9.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ppc ~ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 

diff --git a/sys-libs/glibc/glibc-2.31-r6.ebuild b/sys-libs/glibc/glibc-2.31-r6.ebuild
index 3ac5fb0e9b1..6a994c68e40 100644
--- a/sys-libs/glibc/glibc-2.31-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r6.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ppc ~ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-09-06  4:11 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-09-06  4:11 UTC (permalink / raw
  To: gentoo-commits

commit:     8e0385d8a13b6b62f20ce7b719a159a35c51907a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  6 03:36:55 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Sep  6 03:36:55 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8e0385d8

sys-libs/glibc: ppc64 stable (bug #727758)

Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r9.ebuild | 2 +-
 sys-libs/glibc/glibc-2.31-r6.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30-r9.ebuild b/sys-libs/glibc/glibc-2.30-r9.ebuild
index a1cce5253c2..8765ce6d87e 100644
--- a/sys-libs/glibc/glibc-2.30-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r9.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} == 9999* ]]; then
 	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
 	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 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 

diff --git a/sys-libs/glibc/glibc-2.31-r6.ebuild b/sys-libs/glibc/glibc-2.31-r6.ebuild
index 6a994c68e40..fab85b6f35d 100644
--- a/sys-libs/glibc/glibc-2.31-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r6.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-09-15 22:15 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-09-15 22:15 UTC (permalink / raw
  To: gentoo-commits

commit:     d1cd3ed5e4670b1c71b4519256ffd0f9b73642df
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 15 22:14:46 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Sep 15 22:15:24 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d1cd3ed5

sys-libs/glibc: extend -mcpu= filter from ppc to ppc+ppc64

glibc shares CPU detection code for powerpc/powerpc64.
gcc-10 will advertise G5 as power7:

    $ echo 'int main(){}' |  powerpc64-unknown-linux-gnu-gcc \
        -mcpu=970 -S -x c - -o - | fgrep machine
      .machine power7

which is too high for multiarch.

Bug: https://sourceware.org/PR26522
Bug: https://bugs.gentoo.org/737996
Package-Manager: Portage-3.0.7, Repoman-3.0.1
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r6.ebuild | 2 +-
 sys-libs/glibc/glibc-2.31-r7.ebuild | 2 +-
 sys-libs/glibc/glibc-2.32-r1.ebuild | 2 +-
 sys-libs/glibc/glibc-2.32.ebuild    | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.31-r6.ebuild b/sys-libs/glibc/glibc-2.31-r6.ebuild
index fab85b6f35d..671c8ee63a2 100644
--- a/sys-libs/glibc/glibc-2.31-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r6.ebuild
@@ -301,7 +301,7 @@ setup_target_flags() {
 			# The mips abi cannot support the GNU style hashes. #233233
 			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
 		;;
-		ppc)
+		ppc|ppc64)
 			# Many arch-specific implementations do not work on ppc with
 			# cache-block not equal to 128 bytes. This breaks memset:
 			#   https://sourceware.org/PR26522

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index 91c98436a19..07f25009bd1 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -301,7 +301,7 @@ setup_target_flags() {
 			# The mips abi cannot support the GNU style hashes. #233233
 			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
 		;;
-		ppc)
+		ppc|ppc64)
 			# Many arch-specific implementations do not work on ppc with
 			# cache-block not equal to 128 bytes. This breaks memset:
 			#   https://sourceware.org/PR26522

diff --git a/sys-libs/glibc/glibc-2.32-r1.ebuild b/sys-libs/glibc/glibc-2.32-r1.ebuild
index b51024529ad..18d94a7b0ef 100644
--- a/sys-libs/glibc/glibc-2.32-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r1.ebuild
@@ -302,7 +302,7 @@ setup_target_flags() {
 			# The mips abi cannot support the GNU style hashes. #233233
 			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
 		;;
-		ppc)
+		ppc|ppc64)
 			# Many arch-specific implementations do not work on ppc with
 			# cache-block not equal to 128 bytes. This breaks memset:
 			#   https://sourceware.org/PR26522

diff --git a/sys-libs/glibc/glibc-2.32.ebuild b/sys-libs/glibc/glibc-2.32.ebuild
index 062f5445621..bf2ba5df852 100644
--- a/sys-libs/glibc/glibc-2.32.ebuild
+++ b/sys-libs/glibc/glibc-2.32.ebuild
@@ -301,7 +301,7 @@ setup_target_flags() {
 			# The mips abi cannot support the GNU style hashes. #233233
 			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
 		;;
-		ppc)
+		ppc|ppc64)
 			# Many arch-specific implementations do not work on ppc with
 			# cache-block not equal to 128 bytes. This breaks memset:
 			#   https://sourceware.org/PR26522

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2319a1e0342..643e0b3883c 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -302,7 +302,7 @@ setup_target_flags() {
 			# The mips abi cannot support the GNU style hashes. #233233
 			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
 		;;
-		ppc)
+		ppc|ppc64)
 			# Many arch-specific implementations do not work on ppc with
 			# cache-block not equal to 128 bytes. This breaks memset:
 			#   https://sourceware.org/PR26522


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-09-25 18:54 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-09-25 18:54 UTC (permalink / raw
  To: gentoo-commits

commit:     55104ab0a33759928f0cb6bb8edc9a39dc3f5079
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 25 18:53:13 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep 25 18:54:25 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=55104ab0

sys-libs/glibc: Revbump to 2.32 patchset 2

Contains the following fix:
  x86-64: Fix FMA4 detection in ifunc [BZ #26534]

Closes: https://bugs.gentoo.org/740110
Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.32-r2.ebuild | 1505 +++++++++++++++++++++++++++++++++++
 2 files changed, 1506 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 18bbbabeaa1..90e1d760143 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -12,6 +12,7 @@ DIST glibc-2.31-patches-8.tar.xz 60868 BLAKE2B c641a77cab0b3e5379a6911a548483266
 DIST glibc-2.31-patches-9.tar.xz 74712 BLAKE2B 62991b67de4def4cca944e8420d2f0139f88b6754c6bc81072bb321c574c1db22641857345325848e1dfb551c10758f582e4425e687a7921cdbd4e7e7923a047 SHA512 699d898e3a8ed02b04573c675f572076e8f747767bfc577a033a49cd7d9078a7a60ac325acd4bd419a93b56edf90ce067baa7578ab315e27885f1f0e13916354
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-2.32-patches-1.tar.xz 7640 BLAKE2B 849bdc1108e1f68f307bb9673f5ecda7c5470815f7d2de7956d529b638aafd4a8f37c22f79bc89d8e5f2efd51878927d3999d80586ec1074c46a52b6e148ea18 SHA512 a206d69693c3d9c527e17307b413aed05bcdefdf2537bb16af97ef31e85e4c48812971b60c00107b6a7c4bdc83c7e8ba1c9ea96f5641520852f98928f1018349
+DIST glibc-2.32-patches-2.tar.xz 8588 BLAKE2B 57a85241e3270d14df0332b039a933c5a7ee4d089684d85cca564eeec2d6796735de60b628c5746858757342922d58993d6cf7187ce1d7102b2299ca2cf8513f SHA512 45bbab9e2f813f55cb4a1438dcd9365170b8facff50b11648ba6022da06c20029bb65a4b06fd906af82aa7461b7374f85105fd7eedb7915cec3f1df3779b68a3
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff
 DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db

diff --git a/sys-libs/glibc/glibc-2.32-r2.ebuild b/sys-libs/glibc/glibc-2.32-r2.ebuild
new file mode 100644
index 00000000000..6f714f6aee1
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.32-r2.ebuild
@@ -0,0 +1,1505 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=2
+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"
+	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+LOCALE_GEN_VER=2.10
+
+SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+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"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
+"
+DEPEND="${COMMON_DEPEND}
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && 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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+	use riscv && unpack backport-rv32.txz
+}
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+
+		if use riscv ; then
+			elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
+			eapply "${WORKDIR}"/backport-rv32
+			einfo "Done."
+		fi
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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
+		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 )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	# Make sure all the ABI's can find the locales and so we only
+	# have to generate one set
+	local a
+	keepdir /usr/$(get_libdir)/locale
+	for a in $(get_install_abis) ; do
+		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+		fi
+	done
+
+	# HACK: If we're building for riscv, we need to additionally make sure that
+	# we can find the locale archive afterwards
+	case ${CTARGET} in
+		riscv*)
+			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
+				dosym ../$(get_libdir)/locale /usr/lib/locale
+			fi
+			;;
+		*) ;;
+	esac
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins posix/gai.conf nss/nsswitch.conf
+
+	# Gentoo-specific
+	newins "${FILESDIR}"/host.conf-1 host.conf
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-09-25 18:54 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-09-25 18:54 UTC (permalink / raw
  To: gentoo-commits

commit:     3ac8365bf261373e9005143b916a5264cc9fd0f6
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 25 18:53:54 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep 25 18:54:29 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ac8365b

sys-libs/glibc: Remove old

Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32.ebuild | 1495 --------------------------------------
 1 file changed, 1495 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.32.ebuild b/sys-libs/glibc/glibc-2.32.ebuild
deleted file mode 100644
index bf2ba5df852..00000000000
--- a/sys-libs/glibc/glibc-2.32.ebuild
+++ /dev/null
@@ -1,1495 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7,8} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=1
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-LOCALE_GEN_VER=2.10
-
-SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && 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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
-}
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins posix/gai.conf nss/nsswitch.conf
-
-	# Gentoo-specific
-	newins "${FILESDIR}"/host.conf-1 host.conf
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-09-25 19:42 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-09-25 19:42 UTC (permalink / raw
  To: gentoo-commits

commit:     af0c4db7d53eafd2a797c082f85662c945ad01de
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 25 19:42:22 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep 25 19:42:40 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=af0c4db7

sys-libs/glibc: Re-keyword 2.31 patchlevel 9

This contains the following fixes:
* Rewrite iconv option parsing [BZ #19519]
* powerpc: Fix incorrect cache line size load in memset (bug 26332)
* nptl: Zero-extend arguments to SETXID syscalls [BZ #26248]
* Disable warnings due to deprecated libselinux symbols used by nss and nscd

Bug: https://bugs.gentoo.org/736904
Bug: https://bugs.gentoo.org/611344
Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index 07f25009bd1..479b14e5114 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-09-30 18:13 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-09-30 18:13 UTC (permalink / raw
  To: gentoo-commits

commit:     26e5324cc9ea5d9ba42a84923df6b64b99e6ae84
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 30 18:12:46 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Sep 30 18:12:59 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=26e5324c

sys-libs/glibc: allow python-3.9

Patch-by: charles17 <AT> arcor.de
Closes: https://bugs.gentoo.org/745054
Package-Manager: Portage-3.0.8, Repoman-3.0.1
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r7.ebuild | 2 +-
 sys-libs/glibc/glibc-2.32-r2.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index 479b14e5114..01548ad138d 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{6,7,8} )
+PYTHON_COMPAT=( python3_{6,7,8,9} )
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing

diff --git a/sys-libs/glibc/glibc-2.32-r2.ebuild b/sys-libs/glibc/glibc-2.32-r2.ebuild
index 6f714f6aee1..8088edcc61a 100644
--- a/sys-libs/glibc/glibc-2.32-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r2.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{6,7,8} )
+PYTHON_COMPAT=( python3_{6,7,8,9} )
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 643e0b3883c..4caa8e76b1b 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{6,7,8} )
+PYTHON_COMPAT=( python3_{6,7,8,9} )
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-10-09 20:40 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-10-09 20:40 UTC (permalink / raw
  To: gentoo-commits

commit:     02b32b254703b22dddb5ce2f71b1a1bf727329d8
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  9 20:40:22 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Oct  9 20:40:39 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=02b32b25

sys-libs/glibc: Add deps on gzip, grep, awk

Closes: https://bugs.gentoo.org/740750
Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r2.ebuild | 16 ++++++++++++++++
 sys-libs/glibc/glibc-9999.ebuild    | 16 ++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.32-r2.ebuild b/sys-libs/glibc/glibc-2.32-r2.ebuild
index 8088edcc61a..6dcb8cf95b1 100644
--- a/sys-libs/glibc/glibc-2.32-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r2.ebuild
@@ -89,11 +89,19 @@ fi
 # and that gcc already contains the hardened patches.
 # Lastly, let's avoid some openssh nastiness, bug 708224, as
 # convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
 BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
 	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
 "
 COMMON_DEPEND="
 	gd? ( media-libs/gd:2= )
@@ -107,9 +115,17 @@ COMMON_DEPEND="
 	!<net-misc/openssh-8.1_p1-r2
 "
 DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
 	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
 	sys-apps/gentoo-functions
 "
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 4caa8e76b1b..ade64de2bd4 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -89,11 +89,19 @@ fi
 # and that gcc already contains the hardened patches.
 # Lastly, let's avoid some openssh nastiness, bug 708224, as
 # convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
 BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
 	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
 "
 COMMON_DEPEND="
 	gd? ( media-libs/gd:2= )
@@ -107,9 +115,17 @@ COMMON_DEPEND="
 	!<net-misc/openssh-8.1_p1-r2
 "
 DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
 	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
 	sys-apps/gentoo-functions
 "
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-10-30 21:45 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-10-30 21:45 UTC (permalink / raw
  To: gentoo-commits

commit:     f5bef89a1670a6116564c133efa817ffdaa02068
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 30 19:36:48 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Oct 30 21:45:17 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f5bef89a

sys-libs/glibc: Remove old

Package-Manager: Portage-3.0.8, Repoman-3.0.2
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.32-r1.ebuild | 1505 -----------------------------------
 2 files changed, 1506 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 90e1d760143..0131d63d77c 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -11,7 +11,6 @@ DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811
 DIST glibc-2.31-patches-8.tar.xz 60868 BLAKE2B c641a77cab0b3e5379a6911a548483266110d747300f6bd4c138754cc35aff266088be8682ba45ac105c946ee309db0bc094b0c3bc48fd4303c925a7594e17e2 SHA512 1bc069d487ff9d4cd33c5d293bb0789114f65af5179b3d9df8ff0a9f043d5ffbcd030d8eabc90b329c896dfdd0409c4b8dac371eafdd380ecc660b9540320637
 DIST glibc-2.31-patches-9.tar.xz 74712 BLAKE2B 62991b67de4def4cca944e8420d2f0139f88b6754c6bc81072bb321c574c1db22641857345325848e1dfb551c10758f582e4425e687a7921cdbd4e7e7923a047 SHA512 699d898e3a8ed02b04573c675f572076e8f747767bfc577a033a49cd7d9078a7a60ac325acd4bd419a93b56edf90ce067baa7578ab315e27885f1f0e13916354
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
-DIST glibc-2.32-patches-1.tar.xz 7640 BLAKE2B 849bdc1108e1f68f307bb9673f5ecda7c5470815f7d2de7956d529b638aafd4a8f37c22f79bc89d8e5f2efd51878927d3999d80586ec1074c46a52b6e148ea18 SHA512 a206d69693c3d9c527e17307b413aed05bcdefdf2537bb16af97ef31e85e4c48812971b60c00107b6a7c4bdc83c7e8ba1c9ea96f5641520852f98928f1018349
 DIST glibc-2.32-patches-2.tar.xz 8588 BLAKE2B 57a85241e3270d14df0332b039a933c5a7ee4d089684d85cca564eeec2d6796735de60b628c5746858757342922d58993d6cf7187ce1d7102b2299ca2cf8513f SHA512 45bbab9e2f813f55cb4a1438dcd9365170b8facff50b11648ba6022da06c20029bb65a4b06fd906af82aa7461b7374f85105fd7eedb7915cec3f1df3779b68a3
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff

diff --git a/sys-libs/glibc/glibc-2.32-r1.ebuild b/sys-libs/glibc/glibc-2.32-r1.ebuild
deleted file mode 100644
index 18d94a7b0ef..00000000000
--- a/sys-libs/glibc/glibc-2.32-r1.ebuild
+++ /dev/null
@@ -1,1505 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7,8} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=1
-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"
-	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-LOCALE_GEN_VER=2.10
-
-SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && 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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
-	use riscv && unpack backport-rv32.txz
-}
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-
-		if use riscv ; then
-			elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
-			eapply "${WORKDIR}"/backport-rv32
-			einfo "Done."
-		fi
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins posix/gai.conf nss/nsswitch.conf
-
-	# Gentoo-specific
-	newins "${FILESDIR}"/host.conf-1 host.conf
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-10-30 22:32 Thomas Deutschmann
  0 siblings, 0 replies; 1076+ messages in thread
From: Thomas Deutschmann @ 2020-10-30 22:32 UTC (permalink / raw
  To: gentoo-commits

commit:     269830570dbdba8027b33dc7b9553effeb6a77d1
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 30 22:31:41 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Fri Oct 30 22:32:27 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=26983057

sys-libs/glibc: x86 stable (bug #751955)

Package-Manager: Portage-3.0.8, Repoman-3.0.2
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r7.ebuild | 2 +-
 sys-libs/glibc/glibc-2.32-r2.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index 01548ad138d..6c3974c64e8 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi

diff --git a/sys-libs/glibc/glibc-2.32-r2.ebuild b/sys-libs/glibc/glibc-2.32-r2.ebuild
index 6dcb8cf95b1..5f8215683ad 100644
--- a/sys-libs/glibc/glibc-2.32-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r2.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-10-31 10:09 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-10-31 10:09 UTC (permalink / raw
  To: gentoo-commits

commit:     853bd89fefd2d421a17e3f0912bb88389ed7b6f7
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 31 10:08:32 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 31 10:08:32 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=853bd89f

sys-libs/glibc: 2.31-7 stable for amd64

Package-Manager: Portage-3.0.8, Repoman-3.0.2
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index 6c3974c64e8..6240a38acb3 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-10-31 11:07 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2020-10-31 11:07 UTC (permalink / raw
  To: gentoo-commits

commit:     555bbb1446ed863e6ea0e71ebc262adcae5e85a0
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 31 11:07:26 2020 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Sat Oct 31 11:07:26 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=555bbb14

sys-libs/glibc: Stabilize 2.32-r2 amd64, #751955

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r2.ebuild b/sys-libs/glibc/glibc-2.32-r2.ebuild
index 5f8215683ad..df64cacad2d 100644
--- a/sys-libs/glibc/glibc-2.32-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r2.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-11-01 10:40 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-11-01 10:40 UTC (permalink / raw
  To: gentoo-commits

commit:     70cf283f9e19d3430f3bbdf06d46e4e2a823c4b6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  1 10:39:06 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Nov  1 10:39:06 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=70cf283f

sys-libs/glibc: Stabilize 2.32-r2 arm, #751955

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r2.ebuild b/sys-libs/glibc/glibc-2.32-r2.ebuild
index 6d0345aca4b..ea08f4c0c79 100644
--- a/sys-libs/glibc/glibc-2.32-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r2.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-11-01 10:40 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-11-01 10:40 UTC (permalink / raw
  To: gentoo-commits

commit:     1c8326bb8ae75bf4d0b8ff25ca1fa5e61ca3d3e5
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  1 10:39:06 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Nov  1 10:39:06 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1c8326bb

sys-libs/glibc: Stabilize 2.31-r7 arm, #751955

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index 01fc9dca7fd..4193e8c110e 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-11-01 10:40 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-11-01 10:40 UTC (permalink / raw
  To: gentoo-commits

commit:     bd9c4c878f0b30d3e965c285d10467dd13226cd9
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  1 10:38:07 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Nov  1 10:38:07 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bd9c4c87

sys-libs/glibc: Stabilize 2.31-r7 arm64, #751955

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index 6240a38acb3..01fc9dca7fd 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-11-01 10:40 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-11-01 10:40 UTC (permalink / raw
  To: gentoo-commits

commit:     f2a1447dc17a0fdb16cfad55a3c87c6def9cfede
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  1 10:38:08 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Nov  1 10:38:08 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f2a1447d

sys-libs/glibc: Stabilize 2.32-r2 arm64, #751955

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r2.ebuild b/sys-libs/glibc/glibc-2.32-r2.ebuild
index df64cacad2d..6d0345aca4b 100644
--- a/sys-libs/glibc/glibc-2.32-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r2.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-11-05 16:48 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-11-05 16:48 UTC (permalink / raw
  To: gentoo-commits

commit:     87de4f72225e052ecbd3414da64b85b3859d3e67
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov  5 16:48:47 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov  5 16:48:53 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=87de4f72

sys-libs/glibc: Stabilize 2.31-r7 ppc64, #751955

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index 0788f598c2e..2e58b52204b 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-11-05 16:48 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-11-05 16:48 UTC (permalink / raw
  To: gentoo-commits

commit:     b9c822b5d80801130bb79a534a4a8a5e45b26709
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov  5 16:48:47 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov  5 16:48:54 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b9c822b5

sys-libs/glibc: Stabilize 2.32-r2 ppc64, #751955

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r2.ebuild b/sys-libs/glibc/glibc-2.32-r2.ebuild
index 27e58011772..b177381e635 100644
--- a/sys-libs/glibc/glibc-2.32-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r2.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-11-05 16:48 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-11-05 16:48 UTC (permalink / raw
  To: gentoo-commits

commit:     0aa35d3c5d139e9c9e98c1dc9c78c61e2fc49c6b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov  5 16:48:19 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov  5 16:48:52 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0aa35d3c

sys-libs/glibc: Stabilize 2.31-r7 ppc, #751955

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index 4193e8c110e..0788f598c2e 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-11-05 16:48 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-11-05 16:48 UTC (permalink / raw
  To: gentoo-commits

commit:     3ecd121903bd525ad8a3a14439ec3a744f498e33
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov  5 16:48:20 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov  5 16:48:53 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ecd1219

sys-libs/glibc: Stabilize 2.32-r2 ppc, #751955

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r2.ebuild b/sys-libs/glibc/glibc-2.32-r2.ebuild
index ea08f4c0c79..27e58011772 100644
--- a/sys-libs/glibc/glibc-2.32-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r2.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-11-10 19:16 Mike Gilbert
  0 siblings, 0 replies; 1076+ messages in thread
From: Mike Gilbert @ 2020-11-10 19:16 UTC (permalink / raw
  To: gentoo-commits

commit:     f0d5c947f4d53e8e2ec1762ff20c23328362a943
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Mon Nov  9 20:13:29 2020 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Tue Nov 10 19:15:45 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f0d5c947

sys-libs/glibc: move local-archive to /usr/lib/locale

Closes: https://bugs.gentoo.org/753740
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 .../{glibc-9999.ebuild => glibc-2.32-r3.ebuild}    | 59 ++++++++++++----------
 sys-libs/glibc/glibc-9999.ebuild                   | 32 +++++-------
 2 files changed, 45 insertions(+), 46 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.32-r3.ebuild
similarity index 97%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.32-r3.ebuild
index ade64de2bd4..bbb7b0dfa30 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r3.ebuild
@@ -16,16 +16,16 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=16
-PATCH_DEV=slyfox
+PATCH_VER=2
+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=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"
 fi
 
 RELEASE_VER=${PV}
@@ -133,13 +133,13 @@ RESTRICT="!test? ( test )"
 
 if [[ ${CATEGORY} == cross-* ]] ; then
 	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/binutils-2.24
 		>=${CATEGORY}/gcc-6
 	)"
 	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
 else
 	BDEPEND+="
-		>=sys-devel/binutils-2.27
+		>=sys-devel/binutils-2.24
 		>=sys-devel/gcc-6
 	"
 	DEPEND+=" virtual/os-headers "
@@ -765,6 +765,7 @@ src_unpack() {
 
 	cd "${WORKDIR}" || die
 	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+	use riscv && unpack backport-rv32.txz
 }
 
 src_prepare() {
@@ -778,6 +779,12 @@ src_prepare() {
 		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
 		eapply "${WORKDIR}"/patches
 		einfo "Done."
+
+		if use riscv ; then
+			elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
+			eapply "${WORKDIR}"/backport-rv32
+			einfo "Done."
+		fi
 	fi
 
 	default
@@ -863,6 +870,14 @@ glibc_do_configure() {
 			# https://sourceware.org/PR24202
 			myconf+=( --enable-stack-protector=no )
 			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			myconf+=( --enable-stack-protector=no )
+			;;
 		*)
 			# Use '=strong' instead of '=all' to protect only functions
 			# worth protecting from stack smashes.
@@ -943,6 +958,11 @@ glibc_do_configure() {
 		$(use_enable static-pie)
 		$(use_enable systemtap)
 		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
 		${EXTRA_ECONF}
 	)
 
@@ -1328,26 +1348,7 @@ glibc_do_src_install() {
 	insinto /etc
 	doins locale.gen
 
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
+	keepdir /usr/lib/locale
 
 	cd "${S}"
 
@@ -1474,6 +1475,12 @@ pkg_preinst() {
 	[[ -n ${ROOT} ]] && return 0
 	[[ -d ${ED}/$(get_libdir) ]] || return 0
 	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# https://bugs.gentoo.org/753740
+		rm "${EROOT}"/usr/lib/locale || die
+	fi
 }
 
 pkg_postinst() {

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ade64de2bd4..c424c7a6b9b 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -943,6 +943,11 @@ glibc_do_configure() {
 		$(use_enable static-pie)
 		$(use_enable systemtap)
 		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
 		${EXTRA_ECONF}
 	)
 
@@ -1328,26 +1333,7 @@ glibc_do_src_install() {
 	insinto /etc
 	doins locale.gen
 
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
+	keepdir /usr/lib/locale
 
 	cd "${S}"
 
@@ -1474,6 +1460,12 @@ pkg_preinst() {
 	[[ -n ${ROOT} ]] && return 0
 	[[ -d ${ED}/$(get_libdir) ]] || return 0
 	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# https://bugs.gentoo.org/753740
+		rm "${EROOT}"/usr/lib/locale || die
+	fi
 }
 
 pkg_postinst() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-11-14  9:15 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2020-11-14  9:15 UTC (permalink / raw
  To: gentoo-commits

commit:     278d4c089cd8fe0d105b6017912e4a86ff60cc3b
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 14 09:15:06 2020 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Sat Nov 14 09:15:06 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=278d4c08

sys-libs/glibc: Stabilize 2.31-r7 s390, #751955

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index 2e58b52204b..dce72823d14 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-11-14  9:15 Mikle Kolyada
  0 siblings, 0 replies; 1076+ messages in thread
From: Mikle Kolyada @ 2020-11-14  9:15 UTC (permalink / raw
  To: gentoo-commits

commit:     214a3790e8a0dabebe8f4f758ab8ca471555d659
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 14 09:15:06 2020 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Sat Nov 14 09:15:06 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=214a3790

sys-libs/glibc: Stabilize 2.32-r2 s390, #751955

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r2.ebuild b/sys-libs/glibc/glibc-2.32-r2.ebuild
index b177381e635..e34d1e0310c 100644
--- a/sys-libs/glibc/glibc-2.32-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r2.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv s390 ~sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-12-08  0:37 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-12-08  0:37 UTC (permalink / raw
  To: gentoo-commits

commit:     973c2804ea92b4acb82e0d61ae9179b0fc15db74
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon Dec  7 22:47:32 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Dec  8 00:37:18 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=973c2804

sys-libs/glibc: 2.32: cut 3 patchset

This patchset includes a few upstream backports:
- sh: Add sh4 fpu Implies folder
- linux: Allow adjtime with NULL argument [BZ #26833]
- __vfscanf_internal: fix aliasing violation (bug 26690)
- iconv: Accept redundant shift sequences in IBM1364 [BZ #26224]
- aarch64: Add unwind information to _start (bug 26853)
- support: Provide a way to reorder responses within the DNS test server
- support: Provide a way to clear the RA bit in DNS server responses
- resolv: Handle transaction ID collisions in parallel queries (bug 26600)
- resolv: Serialize processing in resolv/tst-resolv-txnid-collision
- struct _Unwind_Exception alignment should not depend on compiler flags
- Remove __warn_memset_zero_len [BZ #25399]
- Remove __warndecl
- aarch64: Fix DT_AARCH64_VARIANT_PCS handling [BZ #26798]

Two of them are specual (noticed by Gentoo users):
- "linux: Allow adjtime with NULL argument [BZ #26833]" fixes openntpd
  startup failure.
- "__vfscanf_internal: fix aliasing violation (bug 26690)" fixes gcc-11
  compatibility.

Reported-by: Tobias Leupold
Bug: https://bugs.gentoo.org/756316
Bug: https://sourceware.org/PR26833
Reported-by: andy
Bug: https://bugs.gentoo.org/750992
Bug: https://sourceware.org/PR26690
Package-Manager: Portage-3.0.11, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.32-r4.ebuild | 1513 +++++++++++++++++++++++++++++++++++
 2 files changed, 1514 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 0131d63d77c..4a7bf7b5926 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -12,6 +12,7 @@ DIST glibc-2.31-patches-8.tar.xz 60868 BLAKE2B c641a77cab0b3e5379a6911a548483266
 DIST glibc-2.31-patches-9.tar.xz 74712 BLAKE2B 62991b67de4def4cca944e8420d2f0139f88b6754c6bc81072bb321c574c1db22641857345325848e1dfb551c10758f582e4425e687a7921cdbd4e7e7923a047 SHA512 699d898e3a8ed02b04573c675f572076e8f747767bfc577a033a49cd7d9078a7a60ac325acd4bd419a93b56edf90ce067baa7578ab315e27885f1f0e13916354
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-2.32-patches-2.tar.xz 8588 BLAKE2B 57a85241e3270d14df0332b039a933c5a7ee4d089684d85cca564eeec2d6796735de60b628c5746858757342922d58993d6cf7187ce1d7102b2299ca2cf8513f SHA512 45bbab9e2f813f55cb4a1438dcd9365170b8facff50b11648ba6022da06c20029bb65a4b06fd906af82aa7461b7374f85105fd7eedb7915cec3f1df3779b68a3
+DIST glibc-2.32-patches-3.tar.xz 46516 BLAKE2B f88ea6d34d984cc913b492f570199e3d9b9893e4cef6d93c1404fa46901e0014e6e0dcee7644eed49964093fbedee36e825992b641ac87e1e2623c9882c5b300 SHA512 062360cf16a704d0f02218e765f58b03f510591bb35104ef68f0feac7e02fc4ba68e1cf0576ed40dd1d241eeb55ac3bf229b7f0ec8dde385552ad9ae5a4dabdf
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff
 DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db

diff --git a/sys-libs/glibc/glibc-2.32-r4.ebuild b/sys-libs/glibc/glibc-2.32-r4.ebuild
new file mode 100644
index 00000000000..75489f16007
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.32-r4.ebuild
@@ -0,0 +1,1513 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8,9} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=3
+PATCH_DEV=slyfox
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+LOCALE_GEN_VER=2.10
+
+SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+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"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && 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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+	use riscv && unpack backport-rv32.txz
+}
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+
+		if use riscv ; then
+			elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
+			eapply "${WORKDIR}"/backport-rv32
+			einfo "Done."
+		fi
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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
+		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 )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins posix/gai.conf nss/nsswitch.conf
+
+	# Gentoo-specific
+	newins "${FILESDIR}"/host.conf-1 host.conf
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# https://bugs.gentoo.org/753740
+		rm "${EROOT}"/usr/lib/locale || die
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-12-08  8:30 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-12-08  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     f98d2b1f32c99392b6a7bea550732c0585d1fea8
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  8 07:53:59 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Dec  8 08:30:49 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f98d2b1f

sys-libs/glibc: 2.32: cut 4 patchset

Three new patches:
- iconv: Fix incorrect UCS4 inner loop bounds (BZ#26923)
- x86: Harden printf against non-normal long double values (bug 26649)
- x86: Fix THREAD_SELF definition to avoid ld.so crash (bug 27004)

Should fix CVE-2020-29562, CVE-2020-29573 and another gcc-11 compatibility.

Reported-by: Sam James
Bug: https://bugs.gentoo.org/758359
Reported-by: Sam James
Bug: https://bugs.gentoo.org/758359
Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.32-r5.ebuild | 1513 +++++++++++++++++++++++++++++++++++
 2 files changed, 1514 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 4a7bf7b5926..7cf5862d0be 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -13,6 +13,7 @@ DIST glibc-2.31-patches-9.tar.xz 74712 BLAKE2B 62991b67de4def4cca944e8420d2f0139
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-2.32-patches-2.tar.xz 8588 BLAKE2B 57a85241e3270d14df0332b039a933c5a7ee4d089684d85cca564eeec2d6796735de60b628c5746858757342922d58993d6cf7187ce1d7102b2299ca2cf8513f SHA512 45bbab9e2f813f55cb4a1438dcd9365170b8facff50b11648ba6022da06c20029bb65a4b06fd906af82aa7461b7374f85105fd7eedb7915cec3f1df3779b68a3
 DIST glibc-2.32-patches-3.tar.xz 46516 BLAKE2B f88ea6d34d984cc913b492f570199e3d9b9893e4cef6d93c1404fa46901e0014e6e0dcee7644eed49964093fbedee36e825992b641ac87e1e2623c9882c5b300 SHA512 062360cf16a704d0f02218e765f58b03f510591bb35104ef68f0feac7e02fc4ba68e1cf0576ed40dd1d241eeb55ac3bf229b7f0ec8dde385552ad9ae5a4dabdf
+DIST glibc-2.32-patches-4.tar.xz 49884 BLAKE2B e7f364123d9c7b6be5f769a5be0c71afe345972d123d44797cb427667faf6c2bb27bb979a6dc949ec7cc522ccccfdaed730c44dd48251375be24f9c96dbd2aca SHA512 41548299b083e60dc3df4bad7135eba09e1f4d83ab94cf1ff0240198261338c87a228f53179bf639d04190710e2913679fa2c682fd5d3e31a1250f91e31b1683
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff
 DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db

diff --git a/sys-libs/glibc/glibc-2.32-r5.ebuild b/sys-libs/glibc/glibc-2.32-r5.ebuild
new file mode 100644
index 00000000000..69753ee677c
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.32-r5.ebuild
@@ -0,0 +1,1513 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8,9} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=4
+PATCH_DEV=slyfox
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20180511
+
+LOCALE_GEN_VER=2.10
+
+SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+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"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && 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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+	use riscv && unpack backport-rv32.txz
+}
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+
+		if use riscv ; then
+			elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
+			eapply "${WORKDIR}"/backport-rv32
+			einfo "Done."
+		fi
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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
+		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 )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins posix/gai.conf nss/nsswitch.conf
+
+	# Gentoo-specific
+	newins "${FILESDIR}"/host.conf-1 host.conf
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# https://bugs.gentoo.org/753740
+		rm "${EROOT}"/usr/lib/locale || die
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-12-08  8:30 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-12-08  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     9bcaad3d17243d77ba7e6eb339a956331f0f4089
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  8 08:29:48 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Dec  8 08:30:50 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9bcaad3d

sys-libs/glibc: drop keywords on 2.32-r5 for testing

Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r5.ebuild | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r5.ebuild b/sys-libs/glibc/glibc-2.32-r5.ebuild
index 69753ee677c..b1f87e7e5dd 100644
--- a/sys-libs/glibc/glibc-2.32-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r5.ebuild
@@ -22,7 +22,8 @@ PATCH_DEV=slyfox
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	#Drop keywords for initial testing
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-12-08  8:30 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-12-08  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     ddead95032ea24dced2b7d60af6ef3aa6c24e71f
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  8 08:23:50 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Dec  8 08:30:50 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ddead950

sys-libs/glibc: drop old

Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.32-r4.ebuild | 1513 -----------------------------------
 2 files changed, 1514 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 7cf5862d0be..9ee95ce4633 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -12,7 +12,6 @@ DIST glibc-2.31-patches-8.tar.xz 60868 BLAKE2B c641a77cab0b3e5379a6911a548483266
 DIST glibc-2.31-patches-9.tar.xz 74712 BLAKE2B 62991b67de4def4cca944e8420d2f0139f88b6754c6bc81072bb321c574c1db22641857345325848e1dfb551c10758f582e4425e687a7921cdbd4e7e7923a047 SHA512 699d898e3a8ed02b04573c675f572076e8f747767bfc577a033a49cd7d9078a7a60ac325acd4bd419a93b56edf90ce067baa7578ab315e27885f1f0e13916354
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-2.32-patches-2.tar.xz 8588 BLAKE2B 57a85241e3270d14df0332b039a933c5a7ee4d089684d85cca564eeec2d6796735de60b628c5746858757342922d58993d6cf7187ce1d7102b2299ca2cf8513f SHA512 45bbab9e2f813f55cb4a1438dcd9365170b8facff50b11648ba6022da06c20029bb65a4b06fd906af82aa7461b7374f85105fd7eedb7915cec3f1df3779b68a3
-DIST glibc-2.32-patches-3.tar.xz 46516 BLAKE2B f88ea6d34d984cc913b492f570199e3d9b9893e4cef6d93c1404fa46901e0014e6e0dcee7644eed49964093fbedee36e825992b641ac87e1e2623c9882c5b300 SHA512 062360cf16a704d0f02218e765f58b03f510591bb35104ef68f0feac7e02fc4ba68e1cf0576ed40dd1d241eeb55ac3bf229b7f0ec8dde385552ad9ae5a4dabdf
 DIST glibc-2.32-patches-4.tar.xz 49884 BLAKE2B e7f364123d9c7b6be5f769a5be0c71afe345972d123d44797cb427667faf6c2bb27bb979a6dc949ec7cc522ccccfdaed730c44dd48251375be24f9c96dbd2aca SHA512 41548299b083e60dc3df4bad7135eba09e1f4d83ab94cf1ff0240198261338c87a228f53179bf639d04190710e2913679fa2c682fd5d3e31a1250f91e31b1683
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff

diff --git a/sys-libs/glibc/glibc-2.32-r4.ebuild b/sys-libs/glibc/glibc-2.32-r4.ebuild
deleted file mode 100644
index 75489f16007..00000000000
--- a/sys-libs/glibc/glibc-2.32-r4.ebuild
+++ /dev/null
@@ -1,1513 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7,8,9} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=3
-PATCH_DEV=slyfox
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-LOCALE_GEN_VER=2.10
-
-SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && 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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
-	use riscv && unpack backport-rv32.txz
-}
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-
-		if use riscv ; then
-			elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
-			eapply "${WORKDIR}"/backport-rv32
-			einfo "Done."
-		fi
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins posix/gai.conf nss/nsswitch.conf
-
-	# Gentoo-specific
-	newins "${FILESDIR}"/host.conf-1 host.conf
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# https://bugs.gentoo.org/753740
-		rm "${EROOT}"/usr/lib/locale || die
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-12-08 14:46 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2020-12-08 14:46 UTC (permalink / raw
  To: gentoo-commits

commit:     40bbce46bf14dbaa372fafba244e6397f2d76f62
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  8 14:46:23 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Dec  8 14:46:48 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=40bbce46

sys-libs/glibc: Update amd64 and x86 gcc bootstrap files

Package-Manager: Portage-3.0.9, Repoman-3.0.2
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             | 1 +
 sys-libs/glibc/glibc-2.32-r5.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 9ee95ce4633..0dbcfc6a043 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -1,6 +1,7 @@
 DIST backport-rv32.txz 26416 BLAKE2B 7a6b593859f88a3c040f06324dace4cc6137d14d4580fad9ea285829666d761c3dd01c190746e86846c219423124c77a55bc57b6e56efe6401a9c99d7fa445cd SHA512 d08dc02c4f0a3c5a15c57fbb5190588121c0e0728e6ab2119483407a98625efe58b3c83b44d750b0146171e63dcf8a6dbb6d1a057d042f794eed9adbd1f0293e
 DIST gcc-4.7.3-r1-multilib-bootstrap.tar.bz2 8064097 BLAKE2B 3cc5c82cd57d0fbd26d9a376ee8ca02f119fe9d653311cbe4d2b7b93aec2290adac3be271be19a7fdedae2e11e4b6e32360184e557204e100ad64357f5575d4b SHA512 40b93e194ad41a75d649d84d1c49070680f253a13f0617803243bc61c44fed1ca2d0a7572a97ebb79353f312b58b5f6360be916dd7435928cc53935082e15269
 DIST gcc-multilib-bootstrap-20180511.tar.xz 2392908 BLAKE2B f3cf614399368acd8908f60d894c6344a2fa09383b30c1633a0682bc668367c8a2f8c6fec2d41b6e2178d709a2bd8db57e8b2ab56ba263c7d56f819c15acd061 SHA512 98c766e913693ab42ff790557acde2a36a8001e2648046a685b21964200df8d4d52d8452d499c0068c6648284d086ce062c2d36e2c6c2fd8aacd232d193f2853
+DIST gcc-multilib-bootstrap-20201208.tar.xz 5528452 BLAKE2B 16699a6e4df5b2f28a21776ae9e3728b26a9ea251f5580aa5349545ad7c9f6145b9cb6a12ca8f5f96b9cb2a3c70b7e66ca702e4c6f083ac00408e0a20a69e613 SHA512 a243f505e17d0a7e144e8713c077582412f61d6cf7f79baa846de4fb77f5e0f27e11c9a785e14624e04ac52287b32164e7995323aa11caef59113ac438254347
 DIST glibc-2.19-patches-9.tar.bz2 24584 BLAKE2B a96e930a5bd20fa75d9f259cc2117fa5ce98072274a24a5823bf877e3739fa4c001a94d7865e065ee0527f3974430d27da8038e042340a451ad2052c62724f26 SHA512 a95b3063ade974a3556480b798b317d33c7423a8cb9e69f67249ffb8b3d3c671d70d2d5f782c1efadc0bec4cc49a96d4fe89911f3dfcd85b459f69f3b4f38f0e
 DIST glibc-2.19.tar.xz 12083312 BLAKE2B 9dc03346e0f0df4bf009a92d894b0a9f964ff92b7f4c9663cedf1cb6cf90435f28a15539d33791ecf43ee578fa4e26f916af0367651312ef8f9c1c38ce0dafa2 SHA512 9e021fcb3afbb9ace2a0e37fded231a62de861bd766e29d47163a03182e37add718b7acc3963d1c525f9556773e842297725715acde48dcfbaab6e756af1a23d
 DIST glibc-2.25-patches-15.tar.bz2 78320 BLAKE2B 70c62cc10db13e2844de4d8a18972e0f4d01ba52fbd40db57c11d7b1c2c0d571b894f01e762bb26632fd696a77c299ef0766e2f129d2eda896f58325a754a13c SHA512 7204218ea82b677e0f278c4752ddb90aa0c08ac2349d061de81ec91dac204b0f10fe223d7b1055b9e0c21dac97c835f913a90c0168a5000d3be00dd20027c185

diff --git a/sys-libs/glibc/glibc-2.32-r5.ebuild b/sys-libs/glibc/glibc-2.32-r5.ebuild
index b1f87e7e5dd..1db1817e34f 100644
--- a/sys-libs/glibc/glibc-2.32-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r5.ebuild
@@ -31,7 +31,7 @@ fi
 
 RELEASE_VER=${PV}
 
-GCC_BOOTSTRAP_VER=20180511
+GCC_BOOTSTRAP_VER=20201208
 
 LOCALE_GEN_VER=2.10
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index c424c7a6b9b..d15e3bf4e50 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -30,7 +30,7 @@ fi
 
 RELEASE_VER=${PV}
 
-GCC_BOOTSTRAP_VER=20180511
+GCC_BOOTSTRAP_VER=20201208
 
 LOCALE_GEN_VER=2.10
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-12-08 18:07 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-12-08 18:07 UTC (permalink / raw
  To: gentoo-commits

commit:     899c33b66ff95f885c5b0cb7e33053ab5f5a4506
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  8 18:06:46 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Dec  8 18:07:01 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=899c33b6

sys-libs/glibc: restore keywords on 2.32-r5

Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r5.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.32-r5.ebuild b/sys-libs/glibc/glibc-2.32-r5.ebuild
index 1db1817e34f..1ec93676174 100644
--- a/sys-libs/glibc/glibc-2.32-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r5.ebuild
@@ -22,8 +22,7 @@ PATCH_DEV=slyfox
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#Drop keywords for initial testing
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-12-11  9:09 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-12-11  9:09 UTC (permalink / raw
  To: gentoo-commits

commit:     30f1a6b113a4d96883f46987cd4952cfa4a5cca8
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 11 09:07:32 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Dec 11 09:09:01 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=30f1a6b1

sys-libs/glibc: make mutilib bootstrap files optional

The binaries are only used for moving from smaller set
of ABIs to larger set of ABIs. Usually from 'amd64' to
'x86 amd64' or equivalent.

They are not used on a steady system (unless it's broken).

Let's make them optional for live ebuild first and pick up
for next glibc release.

Reported-by: Luke-Jr
Closes: https://bugs.gentoo.org/759358
Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 8 ++++----
 sys-libs/glibc/metadata.xml      | 1 +
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index d15e3bf4e50..279753c191f 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -35,9 +35,9 @@ GCC_BOOTSTRAP_VER=20201208
 LOCALE_GEN_VER=2.10
 
 SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
-SRC_URI+=" multilib? ( 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 )"
 
-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"
+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"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -743,7 +743,7 @@ src_unpack() {
 	# Consistency is not guaranteed between pkg_ and src_ ...
 	sanity_prechecks
 
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
 
 	setup_env
 
@@ -990,7 +990,7 @@ glibc_do_configure() {
 	# is built with MULTILIB_ABIS="amd64 x86" but we want to
 	# add x32 to it, gcc/glibc don't yet support x32.
 	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
 		echo 'main(){}' > "${T}"/test.c
 		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
 			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index 6630fde73e7..7dc64b63dde 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -12,6 +12,7 @@
  <flag name="debug">When USE=hardened, allow fortify/stack violations to dump core (SIGABRT) and not kill self (SIGKILL)</flag>
  <flag name="gd">build memusage and memusagestat tools</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="nscd">Build, and enable support for, the Name Service Cache Daemon</flag>
  <flag name="rpc">Enable obsolete RPC/NIS layers</flag>
  <flag name="ssp">protect stack of glibc internals</flag>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-12-13  7:42 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-12-13  7:42 UTC (permalink / raw
  To: gentoo-commits

commit:     781cf0cf22df08a79929b4c9d5c88cb95f45c68c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 13 07:42:31 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Dec 13 07:42:31 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=781cf0cf

sys-libs/glibc: Stabilize 2.32-r3 s390, #759640

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r3.ebuild b/sys-libs/glibc/glibc-2.32-r3.ebuild
index bbb7b0dfa30..6ee60d7040c 100644
--- a/sys-libs/glibc/glibc-2.32-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r3.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 ~sparc ~x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-12-13 21:45 Thomas Deutschmann
  0 siblings, 0 replies; 1076+ messages in thread
From: Thomas Deutschmann @ 2020-12-13 21:45 UTC (permalink / raw
  To: gentoo-commits

commit:     d46593eda6f70f3920be23eee81d6be85ca88872
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 13 21:43:37 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Dec 13 21:43:37 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d46593ed

sys-libs/glibc: x86 stable (bug #759640)

Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r3.ebuild b/sys-libs/glibc/glibc-2.32-r3.ebuild
index 6ee60d7040c..c02cfa3ebef 100644
--- a/sys-libs/glibc/glibc-2.32-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r3.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 ~sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-12-14  0:46 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-12-14  0:46 UTC (permalink / raw
  To: gentoo-commits

commit:     9a3c93dde2bf88fae3621e9eebb2177a65d47675
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 14 00:38:53 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Dec 14 00:38:53 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9a3c93dd

sys-libs/glibc: arm64 stable (bug #759640)

Package-Manager: Portage-3.0.9, Repoman-3.0.2
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r3.ebuild b/sys-libs/glibc/glibc-2.32-r3.ebuild
index d7c078ddd91..250b6de9743 100644
--- a/sys-libs/glibc/glibc-2.32-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r3.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 ~sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-12-14  0:46 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-12-14  0:46 UTC (permalink / raw
  To: gentoo-commits

commit:     51755456474484ed792e425f8ab79a807936ed8c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 14 00:36:56 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Dec 14 00:36:56 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=51755456

sys-libs/glibc: arm stable (bug #759640)

Package-Manager: Portage-3.0.9, Repoman-3.0.2
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r3.ebuild b/sys-libs/glibc/glibc-2.32-r3.ebuild
index c02cfa3ebef..d7c078ddd91 100644
--- a/sys-libs/glibc/glibc-2.32-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r3.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 ~sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-12-14  8:03 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-12-14  8:03 UTC (permalink / raw
  To: gentoo-commits

commit:     f9eea6b0edf9d9cb8c07fbd37bf2787b88093503
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 14 08:02:24 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Dec 14 08:03:40 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f9eea6b0

sys-libs/glibc: Stabilize 2.32-r3 amd64, #759640

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r3.ebuild b/sys-libs/glibc/glibc-2.32-r3.ebuild
index 250b6de9743..a2c36abaeef 100644
--- a/sys-libs/glibc/glibc-2.32-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r3.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 ~sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-12-23  5:19 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-12-23  5:19 UTC (permalink / raw
  To: gentoo-commits

commit:     4c64d876db2121e4d45cb02c7eecfbda477e6850
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 23 02:29:48 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 23 02:29:48 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4c64d876

sys-libs/glibc: Stabilize 2.32-r3 ppc, #759640

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r3.ebuild b/sys-libs/glibc/glibc-2.32-r3.ebuild
index f795e32ef94..56f67db84f4 100644
--- a/sys-libs/glibc/glibc-2.32-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r3.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ppc ~ppc64 ~riscv s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-12-23  5:19 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-12-23  5:19 UTC (permalink / raw
  To: gentoo-commits

commit:     ebbe3559a3904be65e79b9c0f5a58fe98c030647
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 23 02:30:23 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 23 02:30:23 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ebbe3559

sys-libs/glibc: Stabilize 2.32-r3 ppc64, #759640

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r3.ebuild b/sys-libs/glibc/glibc-2.32-r3.ebuild
index 56f67db84f4..4824a1d657a 100644
--- a/sys-libs/glibc/glibc-2.32-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r3.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-12-23  5:19 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2020-12-23  5:19 UTC (permalink / raw
  To: gentoo-commits

commit:     a36e2b35695a29ac22de955424c2f0d5349b058b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 23 02:28:55 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 23 02:28:55 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a36e2b35

sys-libs/glibc: Stabilize 2.32-r3 sparc, #759640

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r3.ebuild b/sys-libs/glibc/glibc-2.32-r3.ebuild
index a2c36abaeef..f795e32ef94 100644
--- a/sys-libs/glibc/glibc-2.32-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r3.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2020-12-24  8:05 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2020-12-24  8:05 UTC (permalink / raw
  To: gentoo-commits

commit:     50e2dbbcb63c7f35c03709c6ec791300466a27ec
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 24 08:05:19 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Dec 24 08:05:45 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=50e2dbbc

sys-libs/glibc: 2.32: cut 5 patchset

Two new patches:
- tests-mcheck: New variable to run tests with MALLOC_CHECK_=3
- alpha: Remove anonymous union in struct stat [BZ #27042]

Closes: https://bugs.gentoo.org/759001
Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.32-r6.ebuild | 1513 +++++++++++++++++++++++++++++++++++
 2 files changed, 1514 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 0dbcfc6a043..c3dd85eb691 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,6 +14,7 @@ DIST glibc-2.31-patches-9.tar.xz 74712 BLAKE2B 62991b67de4def4cca944e8420d2f0139
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-2.32-patches-2.tar.xz 8588 BLAKE2B 57a85241e3270d14df0332b039a933c5a7ee4d089684d85cca564eeec2d6796735de60b628c5746858757342922d58993d6cf7187ce1d7102b2299ca2cf8513f SHA512 45bbab9e2f813f55cb4a1438dcd9365170b8facff50b11648ba6022da06c20029bb65a4b06fd906af82aa7461b7374f85105fd7eedb7915cec3f1df3779b68a3
 DIST glibc-2.32-patches-4.tar.xz 49884 BLAKE2B e7f364123d9c7b6be5f769a5be0c71afe345972d123d44797cb427667faf6c2bb27bb979a6dc949ec7cc522ccccfdaed730c44dd48251375be24f9c96dbd2aca SHA512 41548299b083e60dc3df4bad7135eba09e1f4d83ab94cf1ff0240198261338c87a228f53179bf639d04190710e2913679fa2c682fd5d3e31a1250f91e31b1683
+DIST glibc-2.32-patches-5.tar.xz 53116 BLAKE2B b2bd9d2cc7fb8f7d3cd96d8439842c30aeed4703e69f959a470967d82dc37ce141f747387c793a3ee6663ed8889af1bcca87fd9ca66c51f1099bba36fe6759d5 SHA512 b3b2baf7b25e28cd4884c4d61f1337b3e49c39dc3f6d789e7cb0a1e180402028da9e8a69828940d2e9676a857d6248da1173d45e8465adca4e148bc2bd76cb62
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff
 DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db

diff --git a/sys-libs/glibc/glibc-2.32-r6.ebuild b/sys-libs/glibc/glibc-2.32-r6.ebuild
new file mode 100644
index 00000000000..415b9cf9d29
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.32-r6.ebuild
@@ -0,0 +1,1513 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8,9} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=5
+PATCH_DEV=slyfox
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+LOCALE_GEN_VER=2.10
+
+SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+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"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && 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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+	use riscv && unpack backport-rv32.txz
+}
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+
+		if use riscv ; then
+			elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
+			eapply "${WORKDIR}"/backport-rv32
+			einfo "Done."
+		fi
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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
+		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 )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins posix/gai.conf nss/nsswitch.conf
+
+	# Gentoo-specific
+	newins "${FILESDIR}"/host.conf-1 host.conf
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# https://bugs.gentoo.org/753740
+		rm "${EROOT}"/usr/lib/locale || die
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-01-07 11:24 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-01-07 11:24 UTC (permalink / raw
  To: gentoo-commits

commit:     0e486a3e2bcba51de8672b544186e147079cdff0
Author:     Andreas K. Huettel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  7 11:24:02 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Jan  7 11:24:27 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0e486a3e

sys-libs/glibc: Patchlevel bump

Bug: https://bugs.gentoo.org/764176
Bug: https://bugs.gentoo.org/763618
Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.32-r7.ebuild | 1513 +++++++++++++++++++++++++++++++++++
 2 files changed, 1514 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index c3dd85eb691..ace2aef49f4 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,6 +15,7 @@ DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d
 DIST glibc-2.32-patches-2.tar.xz 8588 BLAKE2B 57a85241e3270d14df0332b039a933c5a7ee4d089684d85cca564eeec2d6796735de60b628c5746858757342922d58993d6cf7187ce1d7102b2299ca2cf8513f SHA512 45bbab9e2f813f55cb4a1438dcd9365170b8facff50b11648ba6022da06c20029bb65a4b06fd906af82aa7461b7374f85105fd7eedb7915cec3f1df3779b68a3
 DIST glibc-2.32-patches-4.tar.xz 49884 BLAKE2B e7f364123d9c7b6be5f769a5be0c71afe345972d123d44797cb427667faf6c2bb27bb979a6dc949ec7cc522ccccfdaed730c44dd48251375be24f9c96dbd2aca SHA512 41548299b083e60dc3df4bad7135eba09e1f4d83ab94cf1ff0240198261338c87a228f53179bf639d04190710e2913679fa2c682fd5d3e31a1250f91e31b1683
 DIST glibc-2.32-patches-5.tar.xz 53116 BLAKE2B b2bd9d2cc7fb8f7d3cd96d8439842c30aeed4703e69f959a470967d82dc37ce141f747387c793a3ee6663ed8889af1bcca87fd9ca66c51f1099bba36fe6759d5 SHA512 b3b2baf7b25e28cd4884c4d61f1337b3e49c39dc3f6d789e7cb0a1e180402028da9e8a69828940d2e9676a857d6248da1173d45e8465adca4e148bc2bd76cb62
+DIST glibc-2.32-patches-6.tar.xz 54552 BLAKE2B 3c14b7849f53a3c9132c50c4ddcf6cfe42eabfabdfab21231bc1834e030ace88cc2121e4e1e8e74d9137e5b0692b5aca8b62762437317dc57665a1ea63d05014 SHA512 0e03891d992b211ffc5ef21d604f9f8a0adc783af46eea5a81c28024ff13f793dd236f83652eec19308645c9dd68c6017c64626f14edf30fdaeccd65af2167b7
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff
 DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db

diff --git a/sys-libs/glibc/glibc-2.32-r7.ebuild b/sys-libs/glibc/glibc-2.32-r7.ebuild
new file mode 100644
index 00000000000..848e2df3dd6
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.32-r7.ebuild
@@ -0,0 +1,1513 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8,9} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=6
+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"
+	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+LOCALE_GEN_VER=2.10
+
+SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+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"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && 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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+	use riscv && unpack backport-rv32.txz
+}
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+
+		if use riscv ; then
+			elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
+			eapply "${WORKDIR}"/backport-rv32
+			einfo "Done."
+		fi
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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
+		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 )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins posix/gai.conf nss/nsswitch.conf
+
+	# Gentoo-specific
+	newins "${FILESDIR}"/host.conf-1 host.conf
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# https://bugs.gentoo.org/753740
+		rm "${EROOT}"/usr/lib/locale || die
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-01-09 13:12 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2021-01-09 13:12 UTC (permalink / raw
  To: gentoo-commits

commit:     b96f3bb2130993f531ac6c2aab6cd416a012df1b
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Sat Jan  9 12:47:09 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Jan  9 13:12:42 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b96f3bb2

sys-libs/glibc: stable 2.32-r3 for hppa, bug #759640

Package-Manager: Portage-3.0.12, Repoman-3.0.2
RepoMan-Options: --include-arches="hppa"
Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r3.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.32-r3.ebuild b/sys-libs/glibc/glibc-2.32-r3.ebuild
index 4824a1d657a..96c25776517 100644
--- a/sys-libs/glibc/glibc-2.32-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r3.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-01-09 16:22 Lars Wendler
  0 siblings, 0 replies; 1076+ messages in thread
From: Lars Wendler @ 2021-01-09 16:22 UTC (permalink / raw
  To: gentoo-commits

commit:     e351dda0222f489d42f0f0ba717023746c85653d
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  9 16:21:34 2021 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Sat Jan  9 16:22:54 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e351dda0

sys-libs/glibc: v2.32-r5 stable for amd64

Bug: https://bugs.gentoo.org/764584
Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r5.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.32-r5.ebuild b/sys-libs/glibc/glibc-2.32-r5.ebuild
index 1ec93676174..079b70b4798 100644
--- a/sys-libs/glibc/glibc-2.32-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r5.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -22,7 +22,7 @@ PATCH_DEV=slyfox
 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-01-09 16:30 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-01-09 16:30 UTC (permalink / raw
  To: gentoo-commits

commit:     57a7a5a27d423cf12986743d94a51f68fbdfad94
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  9 16:30:20 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jan  9 16:30:20 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=57a7a5a2

sys-libs/glibc: Stabilize 2.32-r5 s390, #764584

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r5.ebuild b/sys-libs/glibc/glibc-2.32-r5.ebuild
index 079b70b4798..a3f248432c2 100644
--- a/sys-libs/glibc/glibc-2.32-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r5.ebuild
@@ -22,7 +22,7 @@ PATCH_DEV=slyfox
 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 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 ~sparc ~x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-01-09 18:00 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-01-09 18:00 UTC (permalink / raw
  To: gentoo-commits

commit:     6bb41ae540d13946135d821a38122c9263a6310a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  9 17:59:46 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jan  9 17:59:59 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6bb41ae5

sys-libs/glibc: Stabilize 2.32-r5 sparc, #764584

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r5.ebuild b/sys-libs/glibc/glibc-2.32-r5.ebuild
index a3f248432c2..7733fed7acb 100644
--- a/sys-libs/glibc/glibc-2.32-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r5.ebuild
@@ -22,7 +22,7 @@ PATCH_DEV=slyfox
 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 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 sparc ~x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-01-12 22:38 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-01-12 22:38 UTC (permalink / raw
  To: gentoo-commits

commit:     ee1d0c216220e8e9f61a617273db9e7424f5bfa8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 12 22:38:21 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jan 12 22:38:21 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee1d0c21

sys-libs/glibc: Stabilize 2.32-r5 x86, #764584

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r5.ebuild b/sys-libs/glibc/glibc-2.32-r5.ebuild
index 7733fed7acb..24530323e4d 100644
--- a/sys-libs/glibc/glibc-2.32-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r5.ebuild
@@ -22,7 +22,7 @@ PATCH_DEV=slyfox
 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 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-01-12 22:41 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-01-12 22:41 UTC (permalink / raw
  To: gentoo-commits

commit:     02357b5f7a57c7f149e5170b914dde34a9210aaa
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 12 22:41:24 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jan 12 22:41:24 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=02357b5f

sys-libs/glibc: Stabilize 2.32-r5 arm64, #764584

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r5.ebuild b/sys-libs/glibc/glibc-2.32-r5.ebuild
index 8ac9ae22325..ac64c00a773 100644
--- a/sys-libs/glibc/glibc-2.32-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r5.ebuild
@@ -22,7 +22,7 @@ PATCH_DEV=slyfox
 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 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-01-12 22:41 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-01-12 22:41 UTC (permalink / raw
  To: gentoo-commits

commit:     cf9b5882173fa2e2e376582bdf15c1cfa78ced73
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 12 22:41:18 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jan 12 22:41:18 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf9b5882

sys-libs/glibc: Stabilize 2.32-r5 arm, #764584

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r5.ebuild b/sys-libs/glibc/glibc-2.32-r5.ebuild
index 24530323e4d..8ac9ae22325 100644
--- a/sys-libs/glibc/glibc-2.32-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r5.ebuild
@@ -22,7 +22,7 @@ PATCH_DEV=slyfox
 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 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-01-24 12:10 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2021-01-24 12:10 UTC (permalink / raw
  To: gentoo-commits

commit:     b0ee830c05f4feeaa6f64d996c612d024e75d387
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 24 12:09:25 2021 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Sun Jan 24 12:09:25 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b0ee830c

sys-libs/glibc: x86 stable wrt bug #766650

Package-Manager: Portage-3.0.9, Repoman-3.0.2
RepoMan-Options: --include-arches="x86"
Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r6.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.32-r6.ebuild b/sys-libs/glibc/glibc-2.32-r6.ebuild
index 415b9cf9d29..d5e0d422afe 100644
--- a/sys-libs/glibc/glibc-2.32-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r6.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -22,7 +22,7 @@ PATCH_DEV=slyfox
 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-01-24 12:33 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2021-01-24 12:33 UTC (permalink / raw
  To: gentoo-commits

commit:     e48b22bcd683d50c980cdb89c4f9138f829323a2
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Sun Jan 24 12:28:54 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jan 24 12:32:59 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e48b22bc

sys-libs/glibc: stable 2.32-r6 for hppa/sparc, bug #766650

Package-Manager: Portage-3.0.13, Repoman-3.0.2
RepoMan-Options: --include-arches="hppa sparc"
Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r6.ebuild b/sys-libs/glibc/glibc-2.32-r6.ebuild
index d5e0d422afe..59500da3ef5 100644
--- a/sys-libs/glibc/glibc-2.32-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r6.ebuild
@@ -22,7 +22,7 @@ PATCH_DEV=slyfox
 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-01 21:17 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-02-01 21:17 UTC (permalink / raw
  To: gentoo-commits

commit:     2b857d62c7410a171e3d48ffa33f6ff58306ce8f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  1 21:17:05 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Feb  1 21:17:46 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2b857d62

sys-libs/glibc: Version bump 2.33

Unkeyworded, for testing

XPASS: elf/tst-latepthread
XPASS: elf/tst-protected1a
XPASS: elf/tst-protected1b
UNSUPPORTED: misc/tst-pkey
UNSUPPORTED: nptl/test-cond-printers
UNSUPPORTED: nptl/test-condattr-printers
UNSUPPORTED: nptl/test-mutex-printers
UNSUPPORTED: nptl/test-mutexattr-printers
UNSUPPORTED: nptl/test-rwlock-printers
UNSUPPORTED: nptl/test-rwlockattr-printers
XPASS: nptl/tst-stack4
UNSUPPORTED: resolv/tst-resolv-ai_idn
UNSUPPORTED: resolv/tst-resolv-ai_idn-latin1
FAIL: stdlib/tst-system
FAIL: string/tst-strerror
FAIL: string/tst-strsignal
XPASS: support/tst-support_descriptors
UNSUPPORTED: time/tst-y2039
Summary of test results:
      3 FAIL
   4246 PASS
     10 UNSUPPORTED
     17 XFAIL
      5 XPASS

Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          |    2 +
 sys-libs/glibc/glibc-2.33.ebuild | 1498 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 1500 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index ace2aef49f4..3b19de759c1 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,5 +17,7 @@ DIST glibc-2.32-patches-4.tar.xz 49884 BLAKE2B e7f364123d9c7b6be5f769a5be0c71afe
 DIST glibc-2.32-patches-5.tar.xz 53116 BLAKE2B b2bd9d2cc7fb8f7d3cd96d8439842c30aeed4703e69f959a470967d82dc37ce141f747387c793a3ee6663ed8889af1bcca87fd9ca66c51f1099bba36fe6759d5 SHA512 b3b2baf7b25e28cd4884c4d61f1337b3e49c39dc3f6d789e7cb0a1e180402028da9e8a69828940d2e9676a857d6248da1173d45e8465adca4e148bc2bd76cb62
 DIST glibc-2.32-patches-6.tar.xz 54552 BLAKE2B 3c14b7849f53a3c9132c50c4ddcf6cfe42eabfabdfab21231bc1834e030ace88cc2121e4e1e8e74d9137e5b0692b5aca8b62762437317dc57665a1ea63d05014 SHA512 0e03891d992b211ffc5ef21d604f9f8a0adc783af46eea5a81c28024ff13f793dd236f83652eec19308645c9dd68c6017c64626f14edf30fdaeccd65af2167b7
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
+DIST glibc-2.33-patches-1.tar.xz 7636 BLAKE2B 8a72d091e506efd0b122ac0822544c7d3b323761f69cd874392abe0d059c58f784b13d9d1b4ab32f8b70118ac8b47dc074cc80349b316f8f4304b894093c3918 SHA512 b9a49adf781fef800618fe8e08a026f5c2a7470c1ac121aabc516d8a4a4c5dd48e90bf7558ebef22656904892e9f9515e57430c68427326da9b5938ea64df871
+DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff
 DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
new file mode 100644
index 00000000000..ee67def4831
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -0,0 +1,1498 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7,8,9} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=1
+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=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+LOCALE_GEN_VER=2.10
+
+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 )"
+
+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"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+}
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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
+		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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins posix/gai.conf nss/nsswitch.conf
+
+	# Gentoo-specific
+	newins "${FILESDIR}"/host.conf-1 host.conf
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# https://bugs.gentoo.org/753740
+		rm "${EROOT}"/usr/lib/locale || die
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-03 10:35 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2021-02-03 10:35 UTC (permalink / raw
  To: gentoo-commits

commit:     5dbd6a821ff753e3b41324c4fb7c58cf65eeea33
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Feb  3 10:27:42 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Feb  3 10:35:00 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5dbd6a82

sys-libs/glibc: disable ISA level annotations on >=2.33

Passing -march= causes glibc to add annotations not compatible to run
result on -march= as too high ISA level is inferred.

ISA level is a new feature of 2.33 release.

Until it's fixed let's disable ISA level inference with
    libc_cv_include_x86_isa_level=no
(no better configure option yet).

Bug: https://sourceware.org/PR27318
Package-Manager: Portage-3.0.14, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33.ebuild | 4 ++++
 sys-libs/glibc/glibc-9999.ebuild | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
index ee67def4831..a1ee8eff85e 100644
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -948,6 +948,10 @@ glibc_do_configure() {
 		# https://bugs.gentoo.org/753740
 		libc_cv_complocaledir='${exec_prefix}/lib/locale'
 
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+
 		${EXTRA_ECONF}
 	)
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 0104a0d7238..fda4b18ea3a 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -948,6 +948,10 @@ glibc_do_configure() {
 		# https://bugs.gentoo.org/753740
 		libc_cv_complocaledir='${exec_prefix}/lib/locale'
 
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+
 		${EXTRA_ECONF}
 	)
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-05 21:39 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-02-05 21:39 UTC (permalink / raw
  To: gentoo-commits

commit:     4be78b55522400be523ba67e562a1b0b206234b3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  5 21:39:36 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb  5 21:39:36 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4be78b55

sys-libs/glibc: Stabilize 2.32-r6 s390, #766650

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r6.ebuild b/sys-libs/glibc/glibc-2.32-r6.ebuild
index 263f4ca321f..2c0d7628083 100644
--- a/sys-libs/glibc/glibc-2.32-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r6.ebuild
@@ -22,7 +22,7 @@ PATCH_DEV=slyfox
 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 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-05 21:42 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-02-05 21:42 UTC (permalink / raw
  To: gentoo-commits

commit:     4aef9862c05a0996e9ccc42ee2e8546519da4211
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  5 21:42:36 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb  5 21:42:36 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4aef9862

sys-libs/glibc: Stabilize 2.32-r6 ppc, #766650

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r6.ebuild b/sys-libs/glibc/glibc-2.32-r6.ebuild
index 2c0d7628083..48f033bc549 100644
--- a/sys-libs/glibc/glibc-2.32-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r6.ebuild
@@ -22,7 +22,7 @@ PATCH_DEV=slyfox
 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 ~m68k ~mips ppc ~ppc64 ~riscv s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-05 21:43 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-02-05 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     f9f666080edd25b16c6cc61b17960dc2ef8b535a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  5 21:43:23 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb  5 21:43:23 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f9f66608

sys-libs/glibc: Stabilize 2.32-r6 ppc64, #766650

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r6.ebuild b/sys-libs/glibc/glibc-2.32-r6.ebuild
index 48f033bc549..94ae74daaba 100644
--- a/sys-libs/glibc/glibc-2.32-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r6.ebuild
@@ -22,7 +22,7 @@ PATCH_DEV=slyfox
 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 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-05 21:44 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-02-05 21:44 UTC (permalink / raw
  To: gentoo-commits

commit:     f11c9ce19d54a4b1e3dd048784335057346a3998
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  5 21:44:17 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb  5 21:44:17 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f11c9ce1

sys-libs/glibc: Stabilize 2.32-r6 amd64, #766650

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r6.ebuild b/sys-libs/glibc/glibc-2.32-r6.ebuild
index 94ae74daaba..e852f9243d2 100644
--- a/sys-libs/glibc/glibc-2.32-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r6.ebuild
@@ -22,7 +22,7 @@ PATCH_DEV=slyfox
 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 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-06 18:27 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2021-02-06 18:27 UTC (permalink / raw
  To: gentoo-commits

commit:     ae161cc44591fdbc20c1a2c6cd38881a88161e45
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  6 18:16:46 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Feb  6 18:27:12 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ae161cc4

sys-libs/glibc: drop old

Package-Manager: Portage-3.0.14, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.30-r8.ebuild | 1465 ----------------------------------
 sys-libs/glibc/glibc-2.31-r6.ebuild | 1495 -----------------------------------
 3 files changed, 2961 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 3b19de759c1..6dd81be8c5d 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -9,7 +9,6 @@ DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1
 DIST glibc-2.30-patches-10.tar.xz 72808 BLAKE2B a7a95c99482524b2896d15539766f1e6b1fe34a22f32119248c6dd44f42632076e86fdcbbdc2d604ec73ceccdd8a7f5936a62a6f4c3d039fae8f6901dfc6be77 SHA512 af5e213ff08bf38f6f529816c36b4e38df27207c2df254609ebe45b2f039ab553bbe563aa6f64b6667d328fd2c120dc21b6e2676540bdd94e58079237089eac3
 DIST glibc-2.30-sparc-reg-fix-clobber.patch 6106 BLAKE2B cad6a4cbef5d529519ef486f4ef8e189cb4d43dd67fa8f8d50d67072cbb682f60474d482a5c5152d1317de92b98851d8a88eee6b331eb5bc22de065c03c58fde SHA512 a018ef1f196257f3888af20a5cbc97892c8382a4f489da042568e087c077f30cf4dda6ac711b573e1274317866ce97cf817d92a28cf55f18f5e8d32787e6cb3f
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
-DIST glibc-2.31-patches-8.tar.xz 60868 BLAKE2B c641a77cab0b3e5379a6911a548483266110d747300f6bd4c138754cc35aff266088be8682ba45ac105c946ee309db0bc094b0c3bc48fd4303c925a7594e17e2 SHA512 1bc069d487ff9d4cd33c5d293bb0789114f65af5179b3d9df8ff0a9f043d5ffbcd030d8eabc90b329c896dfdd0409c4b8dac371eafdd380ecc660b9540320637
 DIST glibc-2.31-patches-9.tar.xz 74712 BLAKE2B 62991b67de4def4cca944e8420d2f0139f88b6754c6bc81072bb321c574c1db22641857345325848e1dfb551c10758f582e4425e687a7921cdbd4e7e7923a047 SHA512 699d898e3a8ed02b04573c675f572076e8f747767bfc577a033a49cd7d9078a7a60ac325acd4bd419a93b56edf90ce067baa7578ab315e27885f1f0e13916354
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-2.32-patches-2.tar.xz 8588 BLAKE2B 57a85241e3270d14df0332b039a933c5a7ee4d089684d85cca564eeec2d6796735de60b628c5746858757342922d58993d6cf7187ce1d7102b2299ca2cf8513f SHA512 45bbab9e2f813f55cb4a1438dcd9365170b8facff50b11648ba6022da06c20029bb65a4b06fd906af82aa7461b7374f85105fd7eedb7915cec3f1df3779b68a3

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild b/sys-libs/glibc/glibc-2.30-r8.ebuild
deleted file mode 100644
index 86afb5aaac8..00000000000
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ /dev/null
@@ -1,1465 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=10
-PATCH_DEV=dilfridge
-
-SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 1) Sandbox
-	tst-ldconfig-bad-aux-cache
-	tst-pldd
-	tst-mallocfork2
-	tst-nss-db-endgrent
-	tst-nss-db-endpwent
-	tst-nss-files-hosts-long
-	tst-nss-test3
-	# 2) Namespaces and cgroup
-	tst-locale-locpath
-	# 9) Failures of unknown origin
-	tst-latepthread
-
-	# buggy test, fixed in glibc-2.31 in 70ba28f7ab29
-	tst-pkey
-
-	# 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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		ia64)
-			# Workaround GPREL22 overflow by slightly pessimizing global
-			# references to go via 64-bit relocations instead of 22-bit ones.
-			# This allows building glibc on ia64 without an overflow: #723268
-			append-flags -fcommon
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.31-r6.ebuild b/sys-libs/glibc/glibc-2.31-r6.ebuild
deleted file mode 100644
index 156e25f568a..00000000000
--- a/sys-libs/glibc/glibc-2.31-r6.ebuild
+++ /dev/null
@@ -1,1495 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=8
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-LOCALE_GEN_VER=2.00
-
-SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && 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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
-}
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins posix/gai.conf nss/nsswitch.conf
-
-	# Gentoo-specific
-	newins "${FILESDIR}"/host.conf-1 host.conf
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-11  7:49 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2021-02-11  7:49 UTC (permalink / raw
  To: gentoo-commits

commit:     cb3e23cb52080dfd33327718f951e6da16cdfc0b
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 11 07:48:56 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Feb 11 07:48:56 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cb3e23cb

sys-libs/glibc: don't use elog for minor messages

Reported-by: Pacho Ramos
Closes: https://bugs.gentoo.org/769908
Package-Manager: Portage-3.0.14, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33.ebuild | 4 ++--
 sys-libs/glibc/glibc-9999.ebuild | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
index a1ee8eff85e..9f63bdf1714 100644
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -775,7 +775,7 @@ src_prepare() {
 		else
 			patchsetname="${RELEASE_VER}-${PATCH_VER}"
 		fi
-		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
 		eapply "${WORKDIR}"/patches
 		einfo "Done."
 	fi
@@ -1406,7 +1406,7 @@ src_install() {
 	foreach_abi glibc_do_src_install
 
 	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
+		einfo "Not installing static glibc libraries"
 		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
 	fi
 }

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index fda4b18ea3a..8442cf8fb91 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -775,7 +775,7 @@ src_prepare() {
 		else
 			patchsetname="${RELEASE_VER}-${PATCH_VER}"
 		fi
-		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
 		eapply "${WORKDIR}"/patches
 		einfo "Done."
 	fi
@@ -1406,7 +1406,7 @@ src_install() {
 	foreach_abi glibc_do_src_install
 
 	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
+		einfo "Not installing static glibc libraries"
 		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
 	fi
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-15  0:38 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-02-15  0:38 UTC (permalink / raw
  To: gentoo-commits

commit:     432b3d1ffb938b1d05e922735ae38cb97a127d59
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 15 00:35:46 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Feb 15 00:35:46 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=432b3d1f

sys-libs/glibc: Stabilize 2.32-r6 arm, #766650

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r6.ebuild b/sys-libs/glibc/glibc-2.32-r6.ebuild
index e852f9243d2..e05b69e194f 100644
--- a/sys-libs/glibc/glibc-2.32-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r6.ebuild
@@ -22,7 +22,7 @@ PATCH_DEV=slyfox
 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 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-24 22:50 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-02-24 22:50 UTC (permalink / raw
  To: gentoo-commits

commit:     ef924e8d907d52ec023d1b237261dd22b3bf6bdb
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 24 22:50:24 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Feb 24 22:50:24 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ef924e8d

sys-libs/glibc: Stabilize 2.32-r6 arm64, #766650

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r6.ebuild b/sys-libs/glibc/glibc-2.32-r6.ebuild
index e05b69e194f..959fb2d9f8b 100644
--- a/sys-libs/glibc/glibc-2.32-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r6.ebuild
@@ -22,7 +22,7 @@ PATCH_DEV=slyfox
 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 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-25 18:17 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-02-25 18:17 UTC (permalink / raw
  To: gentoo-commits

commit:     83d1238d25598dadbf06e3efe61619dbd934c77f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 25 18:17:02 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Feb 25 18:17:45 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=83d1238d

sys-libs/glibc: Remove old

Bug: https://bugs.gentoo.org/758359
Package-Manager: Portage-3.0.13, Repoman-3.0.2
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 -
 sys-libs/glibc/glibc-2.32-r2.ebuild | 1521 -----------------------------------
 sys-libs/glibc/glibc-2.32-r3.ebuild | 1513 ----------------------------------
 sys-libs/glibc/glibc-2.32-r5.ebuild | 1513 ----------------------------------
 4 files changed, 4549 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 6dd81be8c5d..e0e4072d234 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -11,8 +11,6 @@ DIST glibc-2.30-sparc-reg-fix-clobber.patch 6106 BLAKE2B cad6a4cbef5d529519ef486
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-9.tar.xz 74712 BLAKE2B 62991b67de4def4cca944e8420d2f0139f88b6754c6bc81072bb321c574c1db22641857345325848e1dfb551c10758f582e4425e687a7921cdbd4e7e7923a047 SHA512 699d898e3a8ed02b04573c675f572076e8f747767bfc577a033a49cd7d9078a7a60ac325acd4bd419a93b56edf90ce067baa7578ab315e27885f1f0e13916354
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
-DIST glibc-2.32-patches-2.tar.xz 8588 BLAKE2B 57a85241e3270d14df0332b039a933c5a7ee4d089684d85cca564eeec2d6796735de60b628c5746858757342922d58993d6cf7187ce1d7102b2299ca2cf8513f SHA512 45bbab9e2f813f55cb4a1438dcd9365170b8facff50b11648ba6022da06c20029bb65a4b06fd906af82aa7461b7374f85105fd7eedb7915cec3f1df3779b68a3
-DIST glibc-2.32-patches-4.tar.xz 49884 BLAKE2B e7f364123d9c7b6be5f769a5be0c71afe345972d123d44797cb427667faf6c2bb27bb979a6dc949ec7cc522ccccfdaed730c44dd48251375be24f9c96dbd2aca SHA512 41548299b083e60dc3df4bad7135eba09e1f4d83ab94cf1ff0240198261338c87a228f53179bf639d04190710e2913679fa2c682fd5d3e31a1250f91e31b1683
 DIST glibc-2.32-patches-5.tar.xz 53116 BLAKE2B b2bd9d2cc7fb8f7d3cd96d8439842c30aeed4703e69f959a470967d82dc37ce141f747387c793a3ee6663ed8889af1bcca87fd9ca66c51f1099bba36fe6759d5 SHA512 b3b2baf7b25e28cd4884c4d61f1337b3e49c39dc3f6d789e7cb0a1e180402028da9e8a69828940d2e9676a857d6248da1173d45e8465adca4e148bc2bd76cb62
 DIST glibc-2.32-patches-6.tar.xz 54552 BLAKE2B 3c14b7849f53a3c9132c50c4ddcf6cfe42eabfabdfab21231bc1834e030ace88cc2121e4e1e8e74d9137e5b0692b5aca8b62762437317dc57665a1ea63d05014 SHA512 0e03891d992b211ffc5ef21d604f9f8a0adc783af46eea5a81c28024ff13f793dd236f83652eec19308645c9dd68c6017c64626f14edf30fdaeccd65af2167b7
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b

diff --git a/sys-libs/glibc/glibc-2.32-r2.ebuild b/sys-libs/glibc/glibc-2.32-r2.ebuild
deleted file mode 100644
index 51822925228..00000000000
--- a/sys-libs/glibc/glibc-2.32-r2.ebuild
+++ /dev/null
@@ -1,1521 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=2
-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"
-	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-LOCALE_GEN_VER=2.10
-
-SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && 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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
-	use riscv && unpack backport-rv32.txz
-}
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-
-		if use riscv ; then
-			elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
-			eapply "${WORKDIR}"/backport-rv32
-			einfo "Done."
-		fi
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins posix/gai.conf nss/nsswitch.conf
-
-	# Gentoo-specific
-	newins "${FILESDIR}"/host.conf-1 host.conf
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.32-r3.ebuild b/sys-libs/glibc/glibc-2.32-r3.ebuild
deleted file mode 100644
index e2ef95ac14b..00000000000
--- a/sys-libs/glibc/glibc-2.32-r3.ebuild
+++ /dev/null
@@ -1,1513 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=2
-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"
-	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-LOCALE_GEN_VER=2.10
-
-SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && 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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
-	use riscv && unpack backport-rv32.txz
-}
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-
-		if use riscv ; then
-			elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
-			eapply "${WORKDIR}"/backport-rv32
-			einfo "Done."
-		fi
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins posix/gai.conf nss/nsswitch.conf
-
-	# Gentoo-specific
-	newins "${FILESDIR}"/host.conf-1 host.conf
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# https://bugs.gentoo.org/753740
-		rm "${EROOT}"/usr/lib/locale || die
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.32-r5.ebuild b/sys-libs/glibc/glibc-2.32-r5.ebuild
deleted file mode 100644
index 2c2fcd5f865..00000000000
--- a/sys-libs/glibc/glibc-2.32-r5.ebuild
+++ /dev/null
@@ -1,1513 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9} )
-
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=4
-PATCH_DEV=slyfox
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 sparc x86"
-	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-LOCALE_GEN_VER=2.10
-
-SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && 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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
-	use riscv && unpack backport-rv32.txz
-}
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-
-		if use riscv ; then
-			elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
-			eapply "${WORKDIR}"/backport-rv32
-			einfo "Done."
-		fi
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins posix/gai.conf nss/nsswitch.conf
-
-	# Gentoo-specific
-	newins "${FILESDIR}"/host.conf-1 host.conf
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# https://bugs.gentoo.org/753740
-		rm "${EROOT}"/usr/lib/locale || die
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-27 19:18 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-02-27 19:18 UTC (permalink / raw
  To: gentoo-commits

commit:     d446edfec1019a14aa3d2bbdbdfb79845b053b0c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 27 19:17:04 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Feb 27 19:18:01 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d446edfe

sys-libs/glibc: Bump to 2.32 patchlevel 8

Bug: https://bugs.gentoo.org/767718
Bug: https://bugs.gentoo.org/768366
Package-Manager: Portage-3.0.13, Repoman-3.0.2
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.32-r8.ebuild | 1513 +++++++++++++++++++++++++++++++++++
 2 files changed, 1514 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index e0e4072d234..b8f02f9d5fe 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -13,6 +13,7 @@ DIST glibc-2.31-patches-9.tar.xz 74712 BLAKE2B 62991b67de4def4cca944e8420d2f0139
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-2.32-patches-5.tar.xz 53116 BLAKE2B b2bd9d2cc7fb8f7d3cd96d8439842c30aeed4703e69f959a470967d82dc37ce141f747387c793a3ee6663ed8889af1bcca87fd9ca66c51f1099bba36fe6759d5 SHA512 b3b2baf7b25e28cd4884c4d61f1337b3e49c39dc3f6d789e7cb0a1e180402028da9e8a69828940d2e9676a857d6248da1173d45e8465adca4e148bc2bd76cb62
 DIST glibc-2.32-patches-6.tar.xz 54552 BLAKE2B 3c14b7849f53a3c9132c50c4ddcf6cfe42eabfabdfab21231bc1834e030ace88cc2121e4e1e8e74d9137e5b0692b5aca8b62762437317dc57665a1ea63d05014 SHA512 0e03891d992b211ffc5ef21d604f9f8a0adc783af46eea5a81c28024ff13f793dd236f83652eec19308645c9dd68c6017c64626f14edf30fdaeccd65af2167b7
+DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a65f06b22fc5a04aa631b76b3016842365006399715531ee693f3519720edcebef7884247f2f8c19e3518c1ddafab7cc SHA512 5240bc3a6df46d12c03ea4ce7b1a0df85301256ae3bd003fd04c61dadaaec34998873bf20544d891f6eedf896302bb916010aebc1d8d646a3cce09a93b533d0b
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST glibc-2.33-patches-1.tar.xz 7636 BLAKE2B 8a72d091e506efd0b122ac0822544c7d3b323761f69cd874392abe0d059c58f784b13d9d1b4ab32f8b70118ac8b47dc074cc80349b316f8f4304b894093c3918 SHA512 b9a49adf781fef800618fe8e08a026f5c2a7470c1ac121aabc516d8a4a4c5dd48e90bf7558ebef22656904892e9f9515e57430c68427326da9b5938ea64df871
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
new file mode 100644
index 00000000000..334efc53966
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -0,0 +1,1513 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7,8,9} )
+
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=8
+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"
+	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+LOCALE_GEN_VER=2.10
+
+SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
+
+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"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.24
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.24
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# Check for sanity of /etc/nsswitch.conf
+	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
+		local entry
+		for entry in passwd group shadow; do
+			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
+				eerror "Please make sure you have 'files' entries for"
+				eerror "'passwd:', 'group:' and 'shadow:' databases."
+				eerror "For more details see:"
+				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
+				die "nsswitch.conf has no 'files' provider in '${entry}'."
+			fi
+		done
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	sanity_prechecks
+
+	use multilib && 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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+	use riscv && unpack backport-rv32.txz
+}
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+
+		if use riscv ; then
+			elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
+			eapply "${WORKDIR}"/backport-rv32
+			einfo "Done."
+		fi
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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
+		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 )
+			;;
+		powerpc-*)
+			# Currently gcc on powerpc32 generates invalid code for
+			# __builtin_return_address(0) calls. Normally programs
+			# don't do that but malloc hooks in glibc do:
+			# https://gcc.gnu.org/PR81996
+			# https://bugs.gentoo.org/629054
+			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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		ppc64   /lib64/ld64.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins posix/gai.conf nss/nsswitch.conf
+
+	# Gentoo-specific
+	newins "${FILESDIR}"/host.conf-1 host.conf
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		elog "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# https://bugs.gentoo.org/753740
+		rm "${EROOT}"/usr/lib/locale || die
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-27 20:31 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-02-27 20:31 UTC (permalink / raw
  To: gentoo-commits

commit:     e5046391eafbd8adbad9a0f9f7c77f0a991efa6d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 27 20:30:09 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Feb 27 20:30:55 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5046391

sys-libs/glibc: Bump to 2.33 patchlevel 2

Bug: https://bugs.gentoo.org/768366
Package-Manager: Portage-3.0.13, Repoman-3.0.2
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-2.33.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index b8f02f9d5fe..c96fa3c30df 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,7 +15,7 @@ DIST glibc-2.32-patches-5.tar.xz 53116 BLAKE2B b2bd9d2cc7fb8f7d3cd96d8439842c30a
 DIST glibc-2.32-patches-6.tar.xz 54552 BLAKE2B 3c14b7849f53a3c9132c50c4ddcf6cfe42eabfabdfab21231bc1834e030ace88cc2121e4e1e8e74d9137e5b0692b5aca8b62762437317dc57665a1ea63d05014 SHA512 0e03891d992b211ffc5ef21d604f9f8a0adc783af46eea5a81c28024ff13f793dd236f83652eec19308645c9dd68c6017c64626f14edf30fdaeccd65af2167b7
 DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a65f06b22fc5a04aa631b76b3016842365006399715531ee693f3519720edcebef7884247f2f8c19e3518c1ddafab7cc SHA512 5240bc3a6df46d12c03ea4ce7b1a0df85301256ae3bd003fd04c61dadaaec34998873bf20544d891f6eedf896302bb916010aebc1d8d646a3cce09a93b533d0b
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
-DIST glibc-2.33-patches-1.tar.xz 7636 BLAKE2B 8a72d091e506efd0b122ac0822544c7d3b323761f69cd874392abe0d059c58f784b13d9d1b4ab32f8b70118ac8b47dc074cc80349b316f8f4304b894093c3918 SHA512 b9a49adf781fef800618fe8e08a026f5c2a7470c1ac121aabc516d8a4a4c5dd48e90bf7558ebef22656904892e9f9515e57430c68427326da9b5938ea64df871
+DIST glibc-2.33-patches-2.tar.xz 14664 BLAKE2B dc29e11f5caa5a53311107755c0bcc8a9c4c602bc7e295ff727f0e050997b8b2969463586ba2d4229ffdd8ddee4f2857e108b37888e43351cd3bc9f6245ba2dc SHA512 681d62ffc5e6f288cbccf1aadd6c103058cb9c568d1e9ffef6ab6600f2f3cc1dc4a985bfe7c9de960f65331ce7bbad07fd20f743f744c14bf26c4119cc8fee99
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff
 DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
index 9f63bdf1714..fc52ea8c742 100644
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -16,7 +16,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=1
+PATCH_VER=2
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-27 20:50 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-02-27 20:50 UTC (permalink / raw
  To: gentoo-commits

commit:     3a01c689f2b2e81d867a69ea7aaaa015c1b94e7e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 27 20:50:27 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Feb 27 20:50:27 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3a01c689

sys-libs/glibc: Re-add keywords to 2.32-r8

Package-Manager: Portage-3.0.13, Repoman-3.0.2
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index 334efc53966..790c82d04c8 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-28 11:08 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2021-02-28 11:08 UTC (permalink / raw
  To: gentoo-commits

commit:     af5a646e59bcd15bf2175f97f60dc22415a76471
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Sun Feb 28 10:41:54 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Feb 28 11:08:17 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=af5a646e

sys-libs/glibc: stable 2.32-r7 for hppa/sparc, bug #764176

Package-Manager: Portage-3.0.13, Repoman-3.0.2
RepoMan-Options: --include-arches="hppa sparc"
Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r7.ebuild b/sys-libs/glibc/glibc-2.32-r7.ebuild
index 091a9e97358..6ad023714d1 100644
--- a/sys-libs/glibc/glibc-2.32-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r7.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc ~x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-28 15:57 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-02-28 15:57 UTC (permalink / raw
  To: gentoo-commits

commit:     57de1b5c2e7d8c2ae9082860e2afda7077080560
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 28 15:57:46 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Feb 28 15:57:46 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=57de1b5c

sys-libs/glibc: Stabilize 2.32-r7 amd64, #764176

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r7.ebuild b/sys-libs/glibc/glibc-2.32-r7.ebuild
index 6ad023714d1..866435b4b90 100644
--- a/sys-libs/glibc/glibc-2.32-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r7.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc ~x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-28 16:00 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-02-28 16:00 UTC (permalink / raw
  To: gentoo-commits

commit:     69a32bc8927c4cc55fd6e1e25eadc69acc501ff3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 28 16:00:05 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Feb 28 16:00:05 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=69a32bc8

sys-libs/glibc: Stabilize 2.32-r7 x86, #764176

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r7.ebuild b/sys-libs/glibc/glibc-2.32-r7.ebuild
index 866435b4b90..c38f5a00765 100644
--- a/sys-libs/glibc/glibc-2.32-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r7.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-02-28 21:33 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-02-28 21:33 UTC (permalink / raw
  To: gentoo-commits

commit:     25bf1c9b60c896c27c452dfcd0b27b92d9365bb7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 28 21:33:38 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Feb 28 21:33:38 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=25bf1c9b

sys-libs/glibc: Stabilize 2.32-r7 arm64, #764176

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r7.ebuild b/sys-libs/glibc/glibc-2.32-r7.ebuild
index c38f5a00765..03889d61785 100644
--- a/sys-libs/glibc/glibc-2.32-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r7.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-03-03 21:32 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-03-03 21:32 UTC (permalink / raw
  To: gentoo-commits

commit:     2a065114f539ce947f01dd737ec60f16fbe4a052
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar  3 21:32:07 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar  3 21:32:07 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2a065114

sys-libs/glibc: Stabilize 2.32-r7 arm, #764176

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r7.ebuild b/sys-libs/glibc/glibc-2.32-r7.ebuild
index 03889d61785..cb8cf86b618 100644
--- a/sys-libs/glibc/glibc-2.32-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r7.ebuild
@@ -22,7 +22,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-03-07 11:58 David Seifert
  0 siblings, 0 replies; 1076+ messages in thread
From: David Seifert @ 2021-03-07 11:58 UTC (permalink / raw
  To: gentoo-commits

commit:     b6f2f49b722ffba663afb68a880031c3d09a88d9
Author:     Theo Anderson <telans <AT> posteo <DOT> de>
AuthorDate: Sun Mar  7 11:57:46 2021 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sun Mar  7 11:57:46 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b6f2f49b

sys-libs/glibc: migrate to tmpfiles.eclass

Package-Manager: Portage-3.0.16, Repoman-3.0.2
Signed-off-by: Theo Anderson <telans <AT> posteo.de>
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild | 6 +++---
 sys-libs/glibc/glibc-2.30-r9.ebuild | 6 +++---
 sys-libs/glibc/glibc-2.31-r7.ebuild | 6 +++---
 sys-libs/glibc/glibc-2.32-r6.ebuild | 4 ++--
 sys-libs/glibc/glibc-2.32-r7.ebuild | 4 ++--
 sys-libs/glibc/glibc-2.32-r8.ebuild | 4 ++--
 sys-libs/glibc/glibc-2.33.ebuild    | 4 ++--
 sys-libs/glibc/glibc-9999.ebuild    | 4 ++--
 8 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index 47ae2c50d61..18d6b18b842 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -1,10 +1,10 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
 
 inherit prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
+	multilib systemd multiprocessing tmpfiles
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
@@ -1178,7 +1178,7 @@ glibc_do_src_install() {
 		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
 
 		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
 	else
 		# Do this since extra/etc/*.conf above might have nscd.conf.
 		rm -f "${ED}"/etc/nscd.conf

diff --git a/sys-libs/glibc/glibc-2.30-r9.ebuild b/sys-libs/glibc/glibc-2.30-r9.ebuild
index 5602ed343b1..154acf9c805 100644
--- a/sys-libs/glibc/glibc-2.30-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r9.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -6,7 +6,7 @@ EAPI=7
 PYTHON_COMPAT=( python3_{7,8} )
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
+	multilib systemd multiprocessing tmpfiles
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
@@ -1328,7 +1328,7 @@ glibc_do_src_install() {
 		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
 
 		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
 	else
 		# Do this since extra/etc/*.conf above might have nscd.conf.
 		rm -f "${ED}"/etc/nscd.conf

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index 7f6c49c2115..59b995881c8 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -6,7 +6,7 @@ EAPI=7
 PYTHON_COMPAT=( python3_{7,8,9} )
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
+	multilib systemd multiprocessing tmpfiles
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
@@ -1359,7 +1359,7 @@ glibc_do_src_install() {
 		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
 
 		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
 	fi
 
 	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc

diff --git a/sys-libs/glibc/glibc-2.32-r6.ebuild b/sys-libs/glibc/glibc-2.32-r6.ebuild
index 959fb2d9f8b..1cecb5628b6 100644
--- a/sys-libs/glibc/glibc-2.32-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r6.ebuild
@@ -6,7 +6,7 @@ EAPI=7
 PYTHON_COMPAT=( python3_{7,8,9} )
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
+	multilib systemd multiprocessing tmpfiles
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
@@ -1371,7 +1371,7 @@ glibc_do_src_install() {
 		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
 
 		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
 	fi
 
 	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc

diff --git a/sys-libs/glibc/glibc-2.32-r7.ebuild b/sys-libs/glibc/glibc-2.32-r7.ebuild
index cb8cf86b618..05d0a50760d 100644
--- a/sys-libs/glibc/glibc-2.32-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r7.ebuild
@@ -6,7 +6,7 @@ EAPI=7
 PYTHON_COMPAT=( python3_{7,8,9} )
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
+	multilib systemd multiprocessing tmpfiles
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
@@ -1371,7 +1371,7 @@ glibc_do_src_install() {
 		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
 
 		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
 	fi
 
 	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index 790c82d04c8..491be98540c 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -6,7 +6,7 @@ EAPI=7
 PYTHON_COMPAT=( python3_{7,8,9} )
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
+	multilib systemd multiprocessing tmpfiles
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
@@ -1371,7 +1371,7 @@ glibc_do_src_install() {
 		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
 
 		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
 	fi
 
 	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
index fc52ea8c742..240eda1e139 100644
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -6,7 +6,7 @@ EAPI=7
 PYTHON_COMPAT=( python3_{7,8,9} )
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
+	multilib systemd multiprocessing tmpfiles
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
@@ -1360,7 +1360,7 @@ glibc_do_src_install() {
 		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
 
 		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
 	fi
 
 	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 8442cf8fb91..9aa1c06f6ab 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -6,7 +6,7 @@ EAPI=7
 PYTHON_COMPAT=( python3_{7,8,9} )
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing
+	multilib systemd multiprocessing tmpfiles
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
@@ -1360,7 +1360,7 @@ glibc_do_src_install() {
 		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
 
 		systemd_dounit nscd/nscd.service
-		systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
 	fi
 
 	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-03-09 12:06 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-03-09 12:06 UTC (permalink / raw
  To: gentoo-commits

commit:     a914eee87a6ee7261e8dea16131f9c9cb324a808
Author:     Theo Anderson <telans <AT> posteo <DOT> de>
AuthorDate: Tue Mar  9 11:44:44 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Mar  9 12:06:10 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a914eee8

sys-libs/glibc: remove dependency on virtual/tmpfiles

Specify TMPFILES_OPTIONAL=1 to to avoid circular dependency

Closes: https://bugs.gentoo.org/774855
Signed-off-by: Theo Anderson <telans <AT> posteo.de>
Closes: https://github.com/gentoo/gentoo/pull/19841
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild | 2 ++
 sys-libs/glibc/glibc-2.30-r9.ebuild | 1 +
 sys-libs/glibc/glibc-2.31-r7.ebuild | 1 +
 sys-libs/glibc/glibc-2.32-r6.ebuild | 1 +
 sys-libs/glibc/glibc-2.32-r7.ebuild | 1 +
 sys-libs/glibc/glibc-2.32-r8.ebuild | 1 +
 sys-libs/glibc/glibc-2.33.ebuild    | 1 +
 sys-libs/glibc/glibc-9999.ebuild    | 1 +
 8 files changed, 9 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index 18d6b18b842..d9240e9aa5a 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -3,6 +3,8 @@
 
 EAPI=6
 
+TMPFILES_OPTIONAL=1
+
 inherit prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing tmpfiles
 

diff --git a/sys-libs/glibc/glibc-2.30-r9.ebuild b/sys-libs/glibc/glibc-2.30-r9.ebuild
index 154acf9c805..ba72c8d12ed 100644
--- a/sys-libs/glibc/glibc-2.30-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r9.ebuild
@@ -4,6 +4,7 @@
 EAPI=7
 
 PYTHON_COMPAT=( python3_{7,8} )
+TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing tmpfiles

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index 59b995881c8..0e8b9b9b849 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -4,6 +4,7 @@
 EAPI=7
 
 PYTHON_COMPAT=( python3_{7,8,9} )
+TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing tmpfiles

diff --git a/sys-libs/glibc/glibc-2.32-r6.ebuild b/sys-libs/glibc/glibc-2.32-r6.ebuild
index 1cecb5628b6..ed0b3e0bf16 100644
--- a/sys-libs/glibc/glibc-2.32-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r6.ebuild
@@ -4,6 +4,7 @@
 EAPI=7
 
 PYTHON_COMPAT=( python3_{7,8,9} )
+TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing tmpfiles

diff --git a/sys-libs/glibc/glibc-2.32-r7.ebuild b/sys-libs/glibc/glibc-2.32-r7.ebuild
index 05d0a50760d..60f158334e6 100644
--- a/sys-libs/glibc/glibc-2.32-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r7.ebuild
@@ -4,6 +4,7 @@
 EAPI=7
 
 PYTHON_COMPAT=( python3_{7,8,9} )
+TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing tmpfiles

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index 491be98540c..9f36987c95b 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -4,6 +4,7 @@
 EAPI=7
 
 PYTHON_COMPAT=( python3_{7,8,9} )
+TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing tmpfiles

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
index 240eda1e139..07d8cb17a34 100644
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -4,6 +4,7 @@
 EAPI=7
 
 PYTHON_COMPAT=( python3_{7,8,9} )
+TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing tmpfiles

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 9aa1c06f6ab..e0cab334934 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -4,6 +4,7 @@
 EAPI=7
 
 PYTHON_COMPAT=( python3_{7,8,9} )
+TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing tmpfiles


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-03-26 15:06 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2021-03-26 15:06 UTC (permalink / raw
  To: gentoo-commits

commit:     6a3d3eac62ea7c5241a8dbe580d7b8b01525003a
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 26 15:05:58 2021 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Fri Mar 26 15:05:58 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6a3d3eac

sys-libs/glibc: s390 stable wrt bug #764176

Package-Manager: Portage-3.0.13, Repoman-3.0.2
RepoMan-Options: --include-arches="s390"
Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r7.ebuild b/sys-libs/glibc/glibc-2.32-r7.ebuild
index 60f158334e6..2ead5dd7c01 100644
--- a/sys-libs/glibc/glibc-2.32-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r7.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-04-02 11:56 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-04-02 11:56 UTC (permalink / raw
  To: gentoo-commits

commit:     775fc67bba69ade71fad9ef8756ef8d135d2a507
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  2 11:55:53 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Apr  2 11:56:35 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=775fc67b

sys-libs/glibc: Bump 2.33 to patchlevel 3

Test results:

FAIL: nss/tst-nss-files-hosts-long
FAIL: stdlib/tst-system
FAIL: string/tst-strerror
FAIL: string/tst-strsignal

Summary of test results:
      4 FAIL
   4251 PASS
     12 UNSUPPORTED
     16 XFAIL
      5 XPASS

Package-Manager: Portage-3.0.13, Repoman-3.0.2
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-2.33.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index c96fa3c30df..320a9bf69d2 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,7 +15,7 @@ DIST glibc-2.32-patches-5.tar.xz 53116 BLAKE2B b2bd9d2cc7fb8f7d3cd96d8439842c30a
 DIST glibc-2.32-patches-6.tar.xz 54552 BLAKE2B 3c14b7849f53a3c9132c50c4ddcf6cfe42eabfabdfab21231bc1834e030ace88cc2121e4e1e8e74d9137e5b0692b5aca8b62762437317dc57665a1ea63d05014 SHA512 0e03891d992b211ffc5ef21d604f9f8a0adc783af46eea5a81c28024ff13f793dd236f83652eec19308645c9dd68c6017c64626f14edf30fdaeccd65af2167b7
 DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a65f06b22fc5a04aa631b76b3016842365006399715531ee693f3519720edcebef7884247f2f8c19e3518c1ddafab7cc SHA512 5240bc3a6df46d12c03ea4ce7b1a0df85301256ae3bd003fd04c61dadaaec34998873bf20544d891f6eedf896302bb916010aebc1d8d646a3cce09a93b533d0b
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
-DIST glibc-2.33-patches-2.tar.xz 14664 BLAKE2B dc29e11f5caa5a53311107755c0bcc8a9c4c602bc7e295ff727f0e050997b8b2969463586ba2d4229ffdd8ddee4f2857e108b37888e43351cd3bc9f6245ba2dc SHA512 681d62ffc5e6f288cbccf1aadd6c103058cb9c568d1e9ffef6ab6600f2f3cc1dc4a985bfe7c9de960f65331ce7bbad07fd20f743f744c14bf26c4119cc8fee99
+DIST glibc-2.33-patches-3.tar.xz 37076 BLAKE2B 718ab706df85c966145958fb6137b5499c1989ff27a62c22beaabd530d641e4937e6d6ab0cf00052b649dc99c3acc319997640eef95669235dab864f5e0afc9f SHA512 6d460976610a1c3bd3dabee9250008b5b3024ba486d598f85bc81cbd0b88188d125714b93a8b253f9b59b292e998f35118562e2a3ca90c418ff14fa53af2a7c3
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff
 DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
index 07d8cb17a34..f1f1ef2d2d4 100644
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -17,7 +17,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=2
+PATCH_VER=3
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-04-03  9:29 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-04-03  9:29 UTC (permalink / raw
  To: gentoo-commits

commit:     403201568d69cb5d00cedfb8799ef8a12e239d0c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  3 09:29:12 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Apr  3 09:29:39 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=40320156

sys-libs/glibc: Re-keyword 2.33

Closes: https://bugs.gentoo.org/770334
Bug: https://bugs.gentoo.org/769989
Package-Manager: Portage-3.0.13, Repoman-3.0.2
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
index f1f1ef2d2d4..6c88ce67180 100644
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -23,8 +23,7 @@ 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=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-05-10  7:22 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2021-05-10  7:22 UTC (permalink / raw
  To: gentoo-commits

commit:     605800519081b08274479cd00dd16a7622e710e5
Author:     Petr Šabata <contyk <AT> redhat <DOT> com>
AuthorDate: Mon May 10 06:44:17 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon May 10 07:22:48 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=60580051

sys-libs/glibc: Filter "-Wl,--relax" from LDFLAGS

The build fails due to the -r & --relax combination passed to the
linker, so let's filter this out.

Closes: https://bugs.gentoo.org/788901
Signed-off-by: Petr Šabata <contyk <AT> redhat.com>
Closes: https://github.com/gentoo/gentoo/pull/20748
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33.ebuild | 4 ++++
 sys-libs/glibc/glibc-9999.ebuild | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
index 332448bce7b..8cda845c34b 100644
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -393,6 +393,10 @@ setup_flags() {
 	# glibc aborts if rpath is set by LDFLAGS
 	filter-ldflags '-Wl,-rpath=*'
 
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
 	# #492892
 	filter-flags -frecord-gcc-switches
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 7887443a98c..95493a554e2 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -394,6 +394,10 @@ setup_flags() {
 	# glibc aborts if rpath is set by LDFLAGS
 	filter-ldflags '-Wl,-rpath=*'
 
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
 	# #492892
 	filter-flags -frecord-gcc-switches
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-05-11 17:04 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2021-05-11 17:04 UTC (permalink / raw
  To: gentoo-commits

commit:     b262745c3362ed866f77973d17af64e2a205488e
Author:     Matt Jolly <Matt.Jolly <AT> footclan <DOT> ninja>
AuthorDate: Tue May 11 10:36:10 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue May 11 17:04:51 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b262745c

sys-libs/glibc: Remove check for 'files' provider.

The check for a files provider breaks on certain valid nsswitch.conf
configurations. As the check was only required for =sys-libs/glibc-2.26
it has been removed.

Closes: https://bugs.gentoo.org/789435
Package-Manager: Portage-3.0.16, Repoman-3.0.2
Signed-off-by: Matt Jolly <Kangie <AT> footclan.ninja>
Closes: https://github.com/gentoo/gentoo/pull/20769
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33.ebuild | 15 ---------------
 sys-libs/glibc/glibc-9999.ebuild | 15 ---------------
 2 files changed, 30 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
index 8cda845c34b..f2eabcd84c0 100644
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -649,21 +649,6 @@ sanity_prechecks() {
 		ewarn "hypervisor, which is probably not what you want."
 	fi
 
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
 	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
 	# we test for...
 	if ! is_crosscompile ; then

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 95493a554e2..d99367f1bca 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -650,21 +650,6 @@ sanity_prechecks() {
 		ewarn "hypervisor, which is probably not what you want."
 	fi
 
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
 	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
 	# we test for...
 	if ! is_crosscompile ; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-05-15 18:10 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2021-05-15 18:10 UTC (permalink / raw
  To: gentoo-commits

commit:     7434293393e028942453047c6b6500fe4b19bb5b
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat May 15 17:58:52 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat May 15 18:10:55 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=74342933

sys-libs/glibc: allow python-3.10

Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
index f2eabcd84c0..db0be61369f 100644
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{7,8,9} )
+PYTHON_COMPAT=( python3_{7,8,9,10} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix toolchain-funcs flag-o-matic gnuconfig \

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index d99367f1bca..fd820a1d523 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{7,8,9} )
+PYTHON_COMPAT=( python3_{7,8,9,10} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix toolchain-funcs flag-o-matic gnuconfig \


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-05-15 18:43 Georgy Yakovlev
  0 siblings, 0 replies; 1076+ messages in thread
From: Georgy Yakovlev @ 2021-05-15 18:43 UTC (permalink / raw
  To: gentoo-commits

commit:     6d0f5a0a936142bed1055f269f3a143c6ce6fff3
Author:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Sat May 15 18:41:43 2021 +0000
Commit:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Sat May 15 18:43:03 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d0f5a0a

sys-libs/glibc: 2.32-r7 ppc64 stable, bug #764176

Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r7.ebuild b/sys-libs/glibc/glibc-2.32-r7.ebuild
index d7bd947414f..01d1088b38d 100644
--- a/sys-libs/glibc/glibc-2.32-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r7.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-05-15 18:43 Georgy Yakovlev
  0 siblings, 0 replies; 1076+ messages in thread
From: Georgy Yakovlev @ 2021-05-15 18:43 UTC (permalink / raw
  To: gentoo-commits

commit:     a462c6d31164ebc8668c5fe3d79101236d836247
Author:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Sat May 15 18:42:55 2021 +0000
Commit:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Sat May 15 18:43:03 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a462c6d3

sys-libs/glibc: 2.32-r7 ppc stable, bug #764176

Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r7.ebuild b/sys-libs/glibc/glibc-2.32-r7.ebuild
index 01d1088b38d..f8798e21fcf 100644
--- a/sys-libs/glibc/glibc-2.32-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r7.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-01 13:56 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-06-01 13:56 UTC (permalink / raw
  To: gentoo-commits

commit:     38fedf268b05ae540117145ddd81159cd1e64cb1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  1 13:55:48 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun  1 13:55:48 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=38fedf26

sys-libs/glibc: Stabilize 2.32-r8 arm, #793692

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index d9bf2bc1bee..ba0cfa7783c 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-01 13:56 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-06-01 13:56 UTC (permalink / raw
  To: gentoo-commits

commit:     c4f88ad3e350811e6827db208ad0867c5983dbca
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  1 13:55:49 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun  1 13:55:49 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4f88ad3

sys-libs/glibc: Stabilize 2.33 arm, #793692

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
index db0be61369f..f225e7352cc 100644
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-01 13:58 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-06-01 13:58 UTC (permalink / raw
  To: gentoo-commits

commit:     2a2ee3bbb6c93465e26b42bb375b66df8acd0d18
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  1 13:57:30 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun  1 13:57:30 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2a2ee3bb

sys-libs/glibc: Stabilize 2.33 sparc, #793692

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
index f225e7352cc..5d822c9aa9e 100644
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-01 13:58 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-06-01 13:58 UTC (permalink / raw
  To: gentoo-commits

commit:     a73544b20e640a55c6c716c0b85c33af4dc72bba
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  1 13:57:29 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun  1 13:57:29 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a73544b2

sys-libs/glibc: Stabilize 2.32-r8 sparc, #793692

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index ba0cfa7783c..ad8d12ef92d 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc ~x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-01 17:58 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-06-01 17:58 UTC (permalink / raw
  To: gentoo-commits

commit:     20326fa6598fc136dd92cb0e88901291371f4b88
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  1 17:57:38 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun  1 17:57:38 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=20326fa6

sys-libs/glibc: Stabilize 2.32-r8 x86, #793692

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index ad8d12ef92d..d15cecf59ec 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-01 17:58 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-06-01 17:58 UTC (permalink / raw
  To: gentoo-commits

commit:     b5ed4a5a824964da3b2ca375b194f800cfa9c564
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  1 17:57:45 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun  1 17:57:45 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b5ed4a5a

sys-libs/glibc: Stabilize 2.33 ppc, #793692

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
index 493bde8eb3f..d3d004369c6 100644
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ppc ~ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-01 17:58 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-06-01 17:58 UTC (permalink / raw
  To: gentoo-commits

commit:     a47946d4d86729a91146638034f4b60907870d14
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  1 17:57:38 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun  1 17:57:38 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a47946d4

sys-libs/glibc: Stabilize 2.33 x86, #793692

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
index 5d822c9aa9e..493bde8eb3f 100644
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-01 17:58 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-06-01 17:58 UTC (permalink / raw
  To: gentoo-commits

commit:     a176ca6a4b93977ccfce5de69215033fdd3755a4
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  1 17:57:51 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun  1 17:57:51 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a176ca6a

sys-libs/glibc: Stabilize 2.32-r8 ppc64, #793692

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index 8be350b5191..7fd297dc2ee 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-01 17:58 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-06-01 17:58 UTC (permalink / raw
  To: gentoo-commits

commit:     2e8ae03a7ce162f0eea8a4ebe7dd4c241c8bf865
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  1 17:57:44 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun  1 17:57:44 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2e8ae03a

sys-libs/glibc: Stabilize 2.32-r8 ppc, #793692

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index d15cecf59ec..8be350b5191 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ppc ~ppc64 ~riscv ~s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-01 17:58 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-06-01 17:58 UTC (permalink / raw
  To: gentoo-commits

commit:     620ba5e9b99a67e5a8860154719d29a4c58295a0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  1 17:57:52 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun  1 17:57:52 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=620ba5e9

sys-libs/glibc: Stabilize 2.33 ppc64, #793692

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
index d3d004369c6..4fc21fb5910 100644
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-01 19:58 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-06-01 19:58 UTC (permalink / raw
  To: gentoo-commits

commit:     9c0977aeaa542203d98a19e7a565ffea52eb7dd9
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  1 19:58:10 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun  1 19:58:10 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9c0977ae

sys-libs/glibc: Stabilize 2.33 amd64, #793692

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
index 4fc21fb5910..7e1d9f3afac 100644
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-01 19:58 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-06-01 19:58 UTC (permalink / raw
  To: gentoo-commits

commit:     2ca3c9e8a2ceb874eefb971c5b3d35853d1b1fac
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  1 19:58:09 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun  1 19:58:09 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2ca3c9e8

sys-libs/glibc: Stabilize 2.32-r8 amd64, #793692

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index 7fd297dc2ee..00ba28e970b 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-06  8:57 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2021-06-06  8:57 UTC (permalink / raw
  To: gentoo-commits

commit:     fc11587f17c79bb53c7f65d8fbfd61bcd70e8100
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Sun Jun  6 08:52:32 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jun  6 08:57:22 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc11587f

sys-libs/glibc: stable 2.32-r8 for hppa, bug #793692

Package-Manager: Portage-3.0.18, Repoman-3.0.2
RepoMan-Options: --include-arches="hppa"
Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index d8f0fe71796..f02000d318d 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-08  7:19 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2021-06-08  7:19 UTC (permalink / raw
  To: gentoo-commits

commit:     0f03fe55907dbce2d0fcb65449146e01e4fe7a30
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  8 07:17:34 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Jun  8 07:19:28 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0f03fe55

sys-libs/glibc: backport ld.so symlink fix for ppc64 LE

From https://sourceware.org/glibc/wiki/ABIList#powerpc glibc
supports two dynamic linker paths:

- 64-bit ELFv1 BE: /lib64/ld64.so.1 (ELFv2 BE is not supported)
- 64-bit ELFv2 LE: /lib64/ld64.so.2 (ELFv1 LE is not supported)

Bug: https://bugs.gentoo.org/755551
Signed-off-by: Alexei Colin <ac <AT> alexeicolin.com>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild | 5 ++++-
 sys-libs/glibc/glibc-2.30-r9.ebuild | 5 ++++-
 sys-libs/glibc/glibc-2.31-r7.ebuild | 5 ++++-
 sys-libs/glibc/glibc-2.32-r6.ebuild | 5 ++++-
 sys-libs/glibc/glibc-2.32-r7.ebuild | 5 ++++-
 sys-libs/glibc/glibc-2.32-r8.ebuild | 5 ++++-
 6 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index 74facde0736..933241c8139 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -1078,7 +1078,6 @@ glibc_do_src_install() {
 		n64     /lib64/ld.so.1
 		# powerpc
 		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
 		# s390
 		s390    /lib/ld.so.1
 		s390x   /lib/ld64.so.1
@@ -1091,12 +1090,16 @@ glibc_do_src_install() {
 		ldso_abi_list+=(
 			# arm
 			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
 		)
 		;;
 	big)
 		ldso_abi_list+=(
 			# arm
 			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
 		)
 		;;
 	esac

diff --git a/sys-libs/glibc/glibc-2.30-r9.ebuild b/sys-libs/glibc/glibc-2.30-r9.ebuild
index 6999aab3d92..c914722d46b 100644
--- a/sys-libs/glibc/glibc-2.30-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r9.ebuild
@@ -1215,7 +1215,6 @@ glibc_do_src_install() {
 		n64     /lib64/ld.so.1
 		# powerpc
 		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
 		# riscv
 		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
 		lp64    /lib/ld-linux-riscv64-lp64.so.1
@@ -1231,12 +1230,16 @@ glibc_do_src_install() {
 		ldso_abi_list+=(
 			# arm
 			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
 		)
 		;;
 	big)
 		ldso_abi_list+=(
 			# arm
 			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
 		)
 		;;
 	esac

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index c9d28dcd752..975a2dec59c 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -1242,7 +1242,6 @@ glibc_do_src_install() {
 		n64     /lib64/ld.so.1
 		# powerpc
 		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
 		# riscv
 		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
 		lp64    /lib/ld-linux-riscv64-lp64.so.1
@@ -1258,12 +1257,16 @@ glibc_do_src_install() {
 		ldso_abi_list+=(
 			# arm
 			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
 		)
 		;;
 	big)
 		ldso_abi_list+=(
 			# arm
 			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
 		)
 		;;
 	esac

diff --git a/sys-libs/glibc/glibc-2.32-r6.ebuild b/sys-libs/glibc/glibc-2.32-r6.ebuild
index b22bf22729e..8afea512b5a 100644
--- a/sys-libs/glibc/glibc-2.32-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r6.ebuild
@@ -1271,7 +1271,6 @@ glibc_do_src_install() {
 		n64     /lib64/ld.so.1
 		# powerpc
 		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
 		# riscv
 		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
 		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
@@ -1289,12 +1288,16 @@ glibc_do_src_install() {
 		ldso_abi_list+=(
 			# arm
 			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
 		)
 		;;
 	big)
 		ldso_abi_list+=(
 			# arm
 			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
 		)
 		;;
 	esac

diff --git a/sys-libs/glibc/glibc-2.32-r7.ebuild b/sys-libs/glibc/glibc-2.32-r7.ebuild
index f8798e21fcf..4725b3e6a7f 100644
--- a/sys-libs/glibc/glibc-2.32-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r7.ebuild
@@ -1271,7 +1271,6 @@ glibc_do_src_install() {
 		n64     /lib64/ld.so.1
 		# powerpc
 		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
 		# riscv
 		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
 		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
@@ -1289,12 +1288,16 @@ glibc_do_src_install() {
 		ldso_abi_list+=(
 			# arm
 			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
 		)
 		;;
 	big)
 		ldso_abi_list+=(
 			# arm
 			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
 		)
 		;;
 	esac

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index f02000d318d..101254fce5a 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -1271,7 +1271,6 @@ glibc_do_src_install() {
 		n64     /lib64/ld.so.1
 		# powerpc
 		ppc     /lib/ld.so.1
-		ppc64   /lib64/ld64.so.1
 		# riscv
 		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
 		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
@@ -1289,12 +1288,16 @@ glibc_do_src_install() {
 		ldso_abi_list+=(
 			# arm
 			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
 		)
 		;;
 	big)
 		ldso_abi_list+=(
 			# arm
 			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
 		)
 		;;
 	esac


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-08  7:19 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2021-06-08  7:19 UTC (permalink / raw
  To: gentoo-commits

commit:     3f4d468e8cd2b3a69c3f9b9a5cdc48e2d794693a
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  8 07:19:09 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Jun  8 07:19:28 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f4d468e

sys-libs/glibc: drop old

Package-Manager: Portage-3.0.19, Repoman-3.0.3
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 -
 sys-libs/glibc/glibc-2.32-r6.ebuild | 1517 -----------------------------------
 sys-libs/glibc/glibc-2.32-r7.ebuild | 1517 -----------------------------------
 3 files changed, 3036 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 320a9bf69d2..e88be2df4ed 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -11,8 +11,6 @@ DIST glibc-2.30-sparc-reg-fix-clobber.patch 6106 BLAKE2B cad6a4cbef5d529519ef486
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-9.tar.xz 74712 BLAKE2B 62991b67de4def4cca944e8420d2f0139f88b6754c6bc81072bb321c574c1db22641857345325848e1dfb551c10758f582e4425e687a7921cdbd4e7e7923a047 SHA512 699d898e3a8ed02b04573c675f572076e8f747767bfc577a033a49cd7d9078a7a60ac325acd4bd419a93b56edf90ce067baa7578ab315e27885f1f0e13916354
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
-DIST glibc-2.32-patches-5.tar.xz 53116 BLAKE2B b2bd9d2cc7fb8f7d3cd96d8439842c30aeed4703e69f959a470967d82dc37ce141f747387c793a3ee6663ed8889af1bcca87fd9ca66c51f1099bba36fe6759d5 SHA512 b3b2baf7b25e28cd4884c4d61f1337b3e49c39dc3f6d789e7cb0a1e180402028da9e8a69828940d2e9676a857d6248da1173d45e8465adca4e148bc2bd76cb62
-DIST glibc-2.32-patches-6.tar.xz 54552 BLAKE2B 3c14b7849f53a3c9132c50c4ddcf6cfe42eabfabdfab21231bc1834e030ace88cc2121e4e1e8e74d9137e5b0692b5aca8b62762437317dc57665a1ea63d05014 SHA512 0e03891d992b211ffc5ef21d604f9f8a0adc783af46eea5a81c28024ff13f793dd236f83652eec19308645c9dd68c6017c64626f14edf30fdaeccd65af2167b7
 DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a65f06b22fc5a04aa631b76b3016842365006399715531ee693f3519720edcebef7884247f2f8c19e3518c1ddafab7cc SHA512 5240bc3a6df46d12c03ea4ce7b1a0df85301256ae3bd003fd04c61dadaaec34998873bf20544d891f6eedf896302bb916010aebc1d8d646a3cce09a93b533d0b
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST glibc-2.33-patches-3.tar.xz 37076 BLAKE2B 718ab706df85c966145958fb6137b5499c1989ff27a62c22beaabd530d641e4937e6d6ab0cf00052b649dc99c3acc319997640eef95669235dab864f5e0afc9f SHA512 6d460976610a1c3bd3dabee9250008b5b3024ba486d598f85bc81cbd0b88188d125714b93a8b253f9b59b292e998f35118562e2a3ca90c418ff14fa53af2a7c3

diff --git a/sys-libs/glibc/glibc-2.32-r6.ebuild b/sys-libs/glibc/glibc-2.32-r6.ebuild
deleted file mode 100644
index 8afea512b5a..00000000000
--- a/sys-libs/glibc/glibc-2.32-r6.ebuild
+++ /dev/null
@@ -1,1517 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=5
-PATCH_DEV=slyfox
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
-	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-LOCALE_GEN_VER=2.10
-
-SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && 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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
-	use riscv && unpack backport-rv32.txz
-}
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-
-		if use riscv ; then
-			elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
-			eapply "${WORKDIR}"/backport-rv32
-			einfo "Done."
-		fi
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins posix/gai.conf nss/nsswitch.conf
-
-	# Gentoo-specific
-	newins "${FILESDIR}"/host.conf-1 host.conf
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# https://bugs.gentoo.org/753740
-		rm "${EROOT}"/usr/lib/locale || die
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.32-r7.ebuild b/sys-libs/glibc/glibc-2.32-r7.ebuild
deleted file mode 100644
index 4725b3e6a7f..00000000000
--- a/sys-libs/glibc/glibc-2.32-r7.ebuild
+++ /dev/null
@@ -1,1517 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=6
-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"
-	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+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-LOCALE_GEN_VER=2.10
-
-SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && 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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
-	use riscv && unpack backport-rv32.txz
-}
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		elog "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-
-		if use riscv ; then
-			elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
-			eapply "${WORKDIR}"/backport-rv32
-			einfo "Done."
-		fi
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins posix/gai.conf nss/nsswitch.conf
-
-	# Gentoo-specific
-	newins "${FILESDIR}"/host.conf-1 host.conf
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# https://bugs.gentoo.org/753740
-		rm "${EROOT}"/usr/lib/locale || die
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-11 17:18 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-06-11 17:18 UTC (permalink / raw
  To: gentoo-commits

commit:     ddff3e8e4dda6e67215c87d1c306ebba60e3923c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 11 17:17:49 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Jun 11 17:18:03 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ddff3e8e

sys-libs/glibc: Install LSB 5.0 compatibility symlink

Package-Manager: Portage-3.0.18, Repoman-3.0.2
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f6c0a1f83f5..dff43ad9f2c 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1292,6 +1292,27 @@ glibc_do_src_install() {
 		fi
 	done
 
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
 	# With devpts under Linux mounted properly, we do not need the pt_chown
 	# binary to be setuid.  This is because the default owners/perms will be
 	# exactly what we want.


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-11 18:31 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-06-11 18:31 UTC (permalink / raw
  To: gentoo-commits

commit:     9c409bd5236c13f9eea3e9db21d1ca6aa228051b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 11 18:30:42 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Jun 11 18:30:58 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9c409bd5

sys-libs/glibc: Version bump, 2.33-r1 (patchset 4)

Package-Manager: Portage-3.0.18, Repoman-3.0.2
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.33-r1.ebuild | 1516 +++++++++++++++++++++++++++++++++++
 2 files changed, 1517 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index e88be2df4ed..e40b5761242 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,6 +14,7 @@ DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d
 DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a65f06b22fc5a04aa631b76b3016842365006399715531ee693f3519720edcebef7884247f2f8c19e3518c1ddafab7cc SHA512 5240bc3a6df46d12c03ea4ce7b1a0df85301256ae3bd003fd04c61dadaaec34998873bf20544d891f6eedf896302bb916010aebc1d8d646a3cce09a93b533d0b
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST glibc-2.33-patches-3.tar.xz 37076 BLAKE2B 718ab706df85c966145958fb6137b5499c1989ff27a62c22beaabd530d641e4937e6d6ab0cf00052b649dc99c3acc319997640eef95669235dab864f5e0afc9f SHA512 6d460976610a1c3bd3dabee9250008b5b3024ba486d598f85bc81cbd0b88188d125714b93a8b253f9b59b292e998f35118562e2a3ca90c418ff14fa53af2a7c3
+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.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff
 DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db

diff --git a/sys-libs/glibc/glibc-2.33-r1.ebuild b/sys-libs/glibc/glibc-2.33-r1.ebuild
new file mode 100644
index 00000000000..442157e224f
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.33-r1.ebuild
@@ -0,0 +1,1516 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7,8,9,10} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=4
+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=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+LOCALE_GEN_VER=2.10
+
+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 )"
+
+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"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+}
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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
+		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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins posix/gai.conf nss/nsswitch.conf
+
+	# Gentoo-specific
+	newins "${FILESDIR}"/host.conf-1 host.conf
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# https://bugs.gentoo.org/753740
+		rm "${EROOT}"/usr/lib/locale || die
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-12 11:39 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2021-06-12 11:39 UTC (permalink / raw
  To: gentoo-commits

commit:     57e4d1f2840ce7048d43f553a1d00caa48abb919
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 12 11:35:43 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Jun 12 11:39:02 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=57e4d1f2

sys-libs/glibc: fix symlink path for ld-lsb for cross-* packages

Closes: https://bugs.gentoo.org/795582
Package-Manager: Portage-3.0.19, Repoman-3.0.3
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r1.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33-r1.ebuild b/sys-libs/glibc/glibc-2.33-r1.ebuild
index 442157e224f..2309075d66b 100644
--- a/sys-libs/glibc/glibc-2.33-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r1.ebuild
@@ -1309,7 +1309,7 @@ glibc_do_src_install() {
 		has ${lsb_ldso_abi} $(get_install_abis) || continue
 
 		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
 		fi
 	done
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index dff43ad9f2c..112a714c393 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1309,7 +1309,7 @@ glibc_do_src_install() {
 		has ${lsb_ldso_abi} $(get_install_abis) || continue
 
 		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
 		fi
 	done
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-13 10:46 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2021-06-13 10:46 UTC (permalink / raw
  To: gentoo-commits

commit:     82d804c3ae944579c8efda0f3bc6ac142e039466
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Sun Jun 13 09:29:59 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jun 13 10:46:05 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=82d804c3

sys-libs/glibc: stable 2.33 for hppa, bug #793692

Package-Manager: Portage-3.0.18, Repoman-3.0.2
RepoMan-Options: --include-arches="hppa"
Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
index 239334c0899..c97ef6b4c66 100644
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-13 13:47 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-06-13 13:47 UTC (permalink / raw
  To: gentoo-commits

commit:     0cf709c1d40817afbcc6de5ffa51c24cd246165f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 13 13:47:03 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Jun 13 13:47:23 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0cf709c1

sys-libs/glibc: Re-keyword 2.33-r1

Package-Manager: Portage-3.0.18, Repoman-3.0.2
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r1.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33-r1.ebuild b/sys-libs/glibc/glibc-2.33-r1.ebuild
index 2309075d66b..fc5b4b0474f 100644
--- a/sys-libs/glibc/glibc-2.33-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r1.ebuild
@@ -23,8 +23,7 @@ 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=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-06-17  8:15 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2021-06-17  8:15 UTC (permalink / raw
  To: gentoo-commits

commit:     0efc5ad7d63239a278a8d07c90a19787da57786e
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 17 08:15:03 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Jun 17 08:15:43 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0efc5ad7

sys-libs/glibc: override x86_lahf_sahf=no x86_movbe=no values

Reported-by: Matt Whitlock
Bug: https://bugs.gentoo.org/785091
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r1.ebuild | 5 +++++
 sys-libs/glibc/glibc-9999.ebuild    | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.33-r1.ebuild b/sys-libs/glibc/glibc-2.33-r1.ebuild
index fc5b4b0474f..5e971e697fe 100644
--- a/sys-libs/glibc/glibc-2.33-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r1.ebuild
@@ -940,6 +940,11 @@ glibc_do_configure() {
 		# -march= option tricks build system to infer too
 		# high ISA level: https://sourceware.org/PR27318
 		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
 
 		${EXTRA_ECONF}
 	)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 112a714c393..e2bc0dad866 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -941,6 +941,11 @@ glibc_do_configure() {
 		# -march= option tricks build system to infer too
 		# high ISA level: https://sourceware.org/PR27318
 		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
 
 		${EXTRA_ECONF}
 	)


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-04 10:29 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2021-07-04 10:29 UTC (permalink / raw
  To: gentoo-commits

commit:     e3bd15ca177f2dac679b3597b3e21816fd1e13a8
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Sun Jul  4 10:11:47 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jul  4 10:28:51 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e3bd15ca

sys-libs/glibc: stable 2.33-r1 for hppa, bug #792261

Package-Manager: Portage-3.0.20, Repoman-3.0.2
RepoMan-Options: --include-arches="hppa"
Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r1.ebuild b/sys-libs/glibc/glibc-2.33-r1.ebuild
index 5e971e697fe..5131f4bd0ef 100644
--- a/sys-libs/glibc/glibc-2.33-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r1.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-05  3:25 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-07-05  3:25 UTC (permalink / raw
  To: gentoo-commits

commit:     6f42fae0b5e28e2aa9bc225bfe3982419a683c8d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jul  5 03:25:32 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jul  5 03:25:32 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f42fae0

sys-libs/glibc: Stabilize 2.33-r1 amd64, #792261

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r1.ebuild b/sys-libs/glibc/glibc-2.33-r1.ebuild
index 5131f4bd0ef..c829f65ffb2 100644
--- a/sys-libs/glibc/glibc-2.33-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r1.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-05  6:06 Sergei Trofimovich
  0 siblings, 0 replies; 1076+ messages in thread
From: Sergei Trofimovich @ 2021-07-05  6:06 UTC (permalink / raw
  To: gentoo-commits

commit:     378e0d2f43aa8d5210f2c00283df4d8c8c989e78
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Mon Jul  5 05:26:07 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon Jul  5 06:05:51 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=378e0d2f

sys-libs/glibc: stable 2.33-r1 for sparc, bug #792261

Package-Manager: Portage-3.0.20, Repoman-3.0.2
RepoMan-Options: --include-arches="sparc"
Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r1.ebuild b/sys-libs/glibc/glibc-2.33-r1.ebuild
index c829f65ffb2..fc0f26a325d 100644
--- a/sys-libs/glibc/glibc-2.33-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r1.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-05  6:59 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2021-07-05  6:59 UTC (permalink / raw
  To: gentoo-commits

commit:     7383b0483cbe5340c9949e812d9d7ed9013a5fbd
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Mon Jul  5 06:59:16 2021 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Mon Jul  5 06:59:16 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7383b048

sys-libs/glibc: x86 stable wrt bug #792261

Package-Manager: Portage-3.0.20, Repoman-3.0.2
RepoMan-Options: --include-arches="x86"
Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r1.ebuild b/sys-libs/glibc/glibc-2.33-r1.ebuild
index fc0f26a325d..40963b19a3a 100644
--- a/sys-libs/glibc/glibc-2.33-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r1.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-08 19:26 Georgy Yakovlev
  0 siblings, 0 replies; 1076+ messages in thread
From: Georgy Yakovlev @ 2021-07-08 19:26 UTC (permalink / raw
  To: gentoo-commits

commit:     a2abd04716d9ec1a26dd87cabec80070a5229656
Author:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  8 19:25:30 2021 +0000
Commit:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Thu Jul  8 19:26:16 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a2abd047

sys-libs/glibc: stabilize 2.33-r1 for ppc64, bug #792261

Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r1.ebuild b/sys-libs/glibc/glibc-2.33-r1.ebuild
index 40963b19a3a..b0ad898257d 100644
--- a/sys-libs/glibc/glibc-2.33-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r1.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-09  4:23 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-07-09  4:23 UTC (permalink / raw
  To: gentoo-commits

commit:     a6b3bf586ac97ab4858208b3966c480962e50d38
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jul  9 04:23:03 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jul  9 04:23:03 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6b3bf58

sys-libs/glibc: Stabilize 2.33-r1 arm64, #792261

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r1.ebuild b/sys-libs/glibc/glibc-2.33-r1.ebuild
index 419cc214e00..fe0ef6cbb24 100644
--- a/sys-libs/glibc/glibc-2.33-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r1.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-09  4:23 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-07-09  4:23 UTC (permalink / raw
  To: gentoo-commits

commit:     f253d07361768c02cfe7c0c2423162a77e0a9967
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jul  9 04:19:14 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jul  9 04:19:14 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f253d073

sys-libs/glibc: Stabilize 2.33-r1 arm, #792261

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r1.ebuild b/sys-libs/glibc/glibc-2.33-r1.ebuild
index b0ad898257d..419cc214e00 100644
--- a/sys-libs/glibc/glibc-2.33-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r1.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-14 20:46 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-07-14 20:46 UTC (permalink / raw
  To: gentoo-commits

commit:     3d0633cc281cb8beb325beaa9627c9858c20fdd5
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 14 18:41:34 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jul 14 20:45:51 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d0633cc

sys-libs/glibc: ~arch revision bump without changes

Bug: https://bugs.gentoo.org/699422
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r2.ebuild | 1520 +++++++++++++++++++++++++++++++++++
 1 file changed, 1520 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.33-r2.ebuild b/sys-libs/glibc/glibc-2.33-r2.ebuild
new file mode 100644
index 00000000000..5e971e697fe
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.33-r2.ebuild
@@ -0,0 +1,1520 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7,8,9,10} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=4
+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"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+LOCALE_GEN_VER=2.10
+
+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 )"
+
+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"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-0.1.10
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+}
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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
+		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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	doins posix/gai.conf nss/nsswitch.conf
+
+	# Gentoo-specific
+	newins "${FILESDIR}"/host.conf-1 host.conf
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# https://bugs.gentoo.org/753740
+		rm "${EROOT}"/usr/lib/locale || die
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-17 17:12 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-07-17 17:12 UTC (permalink / raw
  To: gentoo-commits

commit:     d6535cc0b605b03af4e35cff1bf8ba9f0691dfaf
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 16 22:09:32 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jul 17 17:11:04 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d6535cc0

sys-libs/glibc: add preserve-libs for libcrypt

Bug: https://bugs.gentoo.org/802207
Signed-off-by: Sam James <sam <AT> gentoo.org>
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 .../{glibc-9999.ebuild => glibc-2.33-r3.ebuild}     | 21 +++++++++++++++++----
 sys-libs/glibc/glibc-9999.ebuild                    | 16 +++++++++++++++-
 2 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.33-r3.ebuild
similarity index 98%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.33-r3.ebuild
index e2bc0dad866..73e8908484d 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r3.ebuild
@@ -6,7 +6,7 @@ EAPI=7
 PYTHON_COMPAT=( python3_{7,8,9,10} )
 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,14 +17,13 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=16
-PATCH_DEV=slyfox
+PATCH_VER=4
+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=""
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi
@@ -1489,6 +1488,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 has_version "${CATEGORY}/${PN}[crypt]"; then
+		PRESERVED_OLD_LIBCRYPT=1
+		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
+	else
+		PRESERVED_OLD_LIBCRYPT=0
+	fi
 }
 
 pkg_postinst() {
@@ -1518,4 +1527,8 @@ pkg_postinst() {
 			fi
 		done
 	fi
+
+	if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
+		preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
+	fi
 }

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index e2bc0dad866..b3fc7c71c7b 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -6,7 +6,7 @@ EAPI=7
 PYTHON_COMPAT=( python3_{7,8,9,10} )
 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"
@@ -1489,6 +1489,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 has_version "${CATEGORY}/${PN}[crypt]"; then
+		PRESERVED_OLD_LIBCRYPT=1
+		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
+	else
+		PRESERVED_OLD_LIBCRYPT=0
+	fi
 }
 
 pkg_postinst() {
@@ -1518,4 +1528,8 @@ pkg_postinst() {
 			fi
 		done
 	fi
+
+	if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
+		preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
+	fi
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-17 23:33 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-07-17 23:33 UTC (permalink / raw
  To: gentoo-commits

commit:     e6c8dafeda8ab2bccdb36b490382ed165f58d616
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 17 23:31:17 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jul 17 23:33:40 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e6c8dafe

sys-libs/glibc: remove old -r2

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r2.ebuild | 1520 -----------------------------------
 1 file changed, 1520 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33-r2.ebuild b/sys-libs/glibc/glibc-2.33-r2.ebuild
deleted file mode 100644
index 5e971e697fe..00000000000
--- a/sys-libs/glibc/glibc-2.33-r2.ebuild
+++ /dev/null
@@ -1,1520 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9,10} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=4
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-LOCALE_GEN_VER=2.10
-
-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 )"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
-}
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins posix/gai.conf nss/nsswitch.conf
-
-	# Gentoo-specific
-	newins "${FILESDIR}"/host.conf-1 host.conf
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# https://bugs.gentoo.org/753740
-		rm "${EROOT}"/usr/lib/locale || die
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-17 23:33 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-07-17 23:33 UTC (permalink / raw
  To: gentoo-commits

commit:     5795e3c941b459f686dd2f0f7ecd94a521d2d8f5
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 17 23:29:49 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jul 17 23:33:37 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5795e3c9

sys-libs/glibc: re-keyword 2.33-r3

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r3.ebuild b/sys-libs/glibc/glibc-2.33-r3.ebuild
index 73e8908484d..e424358c1e9 100644
--- a/sys-libs/glibc/glibc-2.33-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r3.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-22 20:00 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-07-22 20:00 UTC (permalink / raw
  To: gentoo-commits

commit:     63b750feadcbe282992ae70902c3174394ee9229
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 22 19:58:25 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Jul 22 20:00:03 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=63b750fe

sys-libs/glibc: Fix last-minute run tests

Upstream now only installs canonical names for shared objects,
which means there is no /lib*/ld*.so anymore ...

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index b3fc7c71c7b..f4d9edbe46d 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1448,6 +1448,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 . -name 'ld-linux*.so.2' -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 +1466,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
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-23 12:28 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-07-23 12:28 UTC (permalink / raw
  To: gentoo-commits

commit:     28a30995d063bed5763a42ba6b115001239b092a
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 23 12:28:22 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Jul 23 12:28:22 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=28a30995

sys-libs/glibc: Require newer pax-utils (for scanelf)

See also
https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=25e4d53c70f2b677dcde1c37cb9c67214b38d611

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f4d9edbe46d..5e67473853c 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -95,7 +95,7 @@ fi
 
 BDEPEND="
 	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
+	>=app-misc/pax-utils-1.3.3
 	sys-devel/bison
 	doc? ( sys-apps/texinfo )
 	!compile-locales? (
@@ -113,7 +113,6 @@ COMMON_DEPEND="
 	suid? ( caps? ( sys-libs/libcap ) )
 	selinux? ( sys-libs/libselinux )
 	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
 "
 DEPEND="${COMMON_DEPEND}
 	compile-locales? (
@@ -128,6 +127,8 @@ RDEPEND="${COMMON_DEPEND}
 	sys-apps/grep
 	virtual/awk
 	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-1.3.3
+	!<net-misc/openssh-8.1_p1-r2
 "
 
 RESTRICT="!test? ( test )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-23 20:31 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-07-23 20:31 UTC (permalink / raw
  To: gentoo-commits

commit:     7dfddd056de5f23bc29591d212f4051ed9d0634e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 23 20:31:26 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Jul 23 20:31:43 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7dfddd05

sys-libs/glibc: Revbump 2.33 patchset 5, systemd useflag

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest                            |  2 ++
 .../{glibc-9999.ebuild => glibc-2.33-r4.ebuild}    | 34 ++++++++++++----------
 sys-libs/glibc/glibc-9999.ebuild                   | 16 ++++++++--
 3 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index e40b5761242..409375a4d1b 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,6 +15,8 @@ DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST glibc-2.33-patches-3.tar.xz 37076 BLAKE2B 718ab706df85c966145958fb6137b5499c1989ff27a62c22beaabd530d641e4937e6d6ab0cf00052b649dc99c3acc319997640eef95669235dab864f5e0afc9f SHA512 6d460976610a1c3bd3dabee9250008b5b3024ba486d598f85bc81cbd0b88188d125714b93a8b253f9b59b292e998f35118562e2a3ca90c418ff14fa53af2a7c3
 DIST glibc-2.33-patches-4.tar.xz 60124 BLAKE2B a7a99f39c16df241745772c31b10946dc44c51e6c09f8a447b905e7dd6ba529aee08f66a581431453c6665485ac1848861559aa3f0aaba8c2061c1f1eb77d9be SHA512 05c33dc465a98097f836783bb5037dfa14b3a2c0c140014f642ea72954222ae919fe2db9573ee70ca9c1881b3b59dd4b815a8f39f331494fa12951c9012797ef
+DIST glibc-2.33-patches-5.tar.xz 63032 BLAKE2B e7f5952b2d84dc264e960d8bd3d9af4ca43089ca269735168933e80a0a74d7be1cadc90935b429cfdf5f0052d3ce3482a8f073b15378e7f9c05034535d9eae4d SHA512 00c2f8f104e7899b76398a6a39f054cd109a71f5fcc4020304b7d7e15ae0c53df1c3acbafd56898427b3849452f9fb9e5064ff584d6c86c4d18c8a9201c89d29
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
+DIST glibc-systemd-20210724.tar.gz 1475 BLAKE2B 065bb4f364162ed168f9e777178ff2559f85db43c3585a45e63fda00dde34071674522cc2133d446c703737a36b1ba3148823ed53de8a4bc22b130a711a41dd0 SHA512 42ede5ef4b872e50cf3b02a3d305fd25675172a4e4461a8072cace688c4935c77267106a53164420e9181437501bc241dd3413806fd1f65eb87ee5ca877455ed
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff
 DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.33-r4.ebuild
similarity index 98%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.33-r4.ebuild
index 5e67473853c..a9e53d7039d 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r4.ebuild
@@ -17,14 +17,13 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=16
-PATCH_DEV=slyfox
+PATCH_VER=5
+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=""
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi
@@ -35,10 +34,13 @@ GCC_BOOTSTRAP_VER=20201208
 
 LOCALE_GEN_VER=2.10
 
+GLIBC_SYSTEMD_VER=20210724
+
 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 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
 MIN_KERN_VER="3.2.0"
@@ -95,7 +97,7 @@ fi
 
 BDEPEND="
 	${PYTHON_DEPS}
-	>=app-misc/pax-utils-1.3.3
+	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
 	doc? ( sys-apps/texinfo )
 	!compile-locales? (
@@ -113,6 +115,7 @@ COMMON_DEPEND="
 	suid? ( caps? ( sys-libs/libcap ) )
 	selinux? ( sys-libs/libselinux )
 	systemtap? ( dev-util/systemtap )
+	!<net-misc/openssh-8.1_p1-r2
 "
 DEPEND="${COMMON_DEPEND}
 	compile-locales? (
@@ -127,8 +130,6 @@ RDEPEND="${COMMON_DEPEND}
 	sys-apps/grep
 	virtual/awk
 	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-1.3.3
-	!<net-misc/openssh-8.1_p1-r2
 "
 
 RESTRICT="!test? ( test )"
@@ -756,6 +757,7 @@ src_unpack() {
 
 	cd "${WORKDIR}" || die
 	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
 }
 
 src_prepare() {
@@ -1363,7 +1365,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
@@ -1379,7 +1387,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
 
@@ -1449,12 +1457,6 @@ 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 . -name 'ld-linux*.so.2' -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})
@@ -1467,7 +1469,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 \
-		${newldso} --library-path . ${x} > /dev/null \
+		./ld-*.so --library-path . ${x} > /dev/null \
 			|| die "simple run test (${x}) failed"
 	done
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 5e67473853c..8904487a6b0 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -35,10 +35,13 @@ GCC_BOOTSTRAP_VER=20201208
 
 LOCALE_GEN_VER=2.10
 
+GLIBC_SYSTEMD_VER=20210724
+
 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 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
 MIN_KERN_VER="3.2.0"
@@ -756,6 +759,7 @@ src_unpack() {
 
 	cd "${WORKDIR}" || die
 	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
 }
 
 src_prepare() {
@@ -1363,7 +1367,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
@@ -1379,7 +1389,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
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-24 13:12 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-07-24 13:12 UTC (permalink / raw
  To: gentoo-commits

commit:     4124a373447e37b3fbc422c235398f3a66982823
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 24 13:11:24 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jul 24 13:11:54 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4124a373

sys-libs/glibc: also find ld.so on arm64 in the last-minute checks

Package-Manager: Portage-3.0.20, Repoman-3.0.2
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 8904487a6b0..69244bf890b 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1461,7 +1461,7 @@ glibc_sanity_check() {
 
 	# first let's find the actual dynamic linker here
 	# symlinks may point to the wrong abi
-	local newldso=$(find . -name 'ld-linux*.so.2' -type f -print -quit)
+	local newldso=$(find . -name 'ld-linux*.so.?' -type f -print -quit)
 
 	einfo Last-minute run tests with ${newldso} in /$(get_libdir) ...
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-24 14:03 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-07-24 14:03 UTC (permalink / raw
  To: gentoo-commits

commit:     522ad9247503555c59cea5f6f6f354710fce5ef9
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 24 14:02:58 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jul 24 14:03:14 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=522ad924

sys-libs/glibc: Even more general expression for ld.so (weird arches)

Package-Manager: Portage-3.0.20, Repoman-3.0.2
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 69244bf890b..107ec16a0ba 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1461,7 +1461,7 @@ glibc_sanity_check() {
 
 	# first let's find the actual dynamic linker here
 	# symlinks may point to the wrong abi
-	local newldso=$(find . -name 'ld-linux*.so.?' -type f -print -quit)
+	local newldso=$(find . -name 'ld*so.?' -type f -print -quit)
 
 	einfo Last-minute run tests with ${newldso} in /$(get_libdir) ...
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-25 21:54 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-07-25 21:54 UTC (permalink / raw
  To: gentoo-commits

commit:     6efbdf908bc6dc13156a09614c9cf08f0c498ea7
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 25 21:54:12 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Jul 25 21:54:12 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6efbdf90

sys-libs/glibc: Rekeyword 2.33-r4

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r4.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r4.ebuild b/sys-libs/glibc/glibc-2.33-r4.ebuild
index a9e53d7039d..8b26b1c9600 100644
--- a/sys-libs/glibc/glibc-2.33-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r4.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-27 20:27 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-07-27 20:27 UTC (permalink / raw
  To: gentoo-commits

commit:     3958d7f0251a4f4246a1e6f716e62e827dec40ac
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 27 19:08:07 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jul 27 20:27:39 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3958d7f0

sys-libs/glibc: Revbump for Microsoft Edge ...

Closes: https://bugs.gentoo.org/804324
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest                                       | 1 +
 sys-libs/glibc/{glibc-2.33-r4.ebuild => glibc-2.33-r5.ebuild} | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 409375a4d1b..c26e786d2e4 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,5 +18,6 @@ DIST glibc-2.33-patches-4.tar.xz 60124 BLAKE2B a7a99f39c16df241745772c31b10946dc
 DIST glibc-2.33-patches-5.tar.xz 63032 BLAKE2B e7f5952b2d84dc264e960d8bd3d9af4ca43089ca269735168933e80a0a74d7be1cadc90935b429cfdf5f0052d3ce3482a8f073b15378e7f9c05034535d9eae4d SHA512 00c2f8f104e7899b76398a6a39f054cd109a71f5fcc4020304b7d7e15ae0c53df1c3acbafd56898427b3849452f9fb9e5064ff584d6c86c4d18c8a9201c89d29
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-systemd-20210724.tar.gz 1475 BLAKE2B 065bb4f364162ed168f9e777178ff2559f85db43c3585a45e63fda00dde34071674522cc2133d446c703737a36b1ba3148823ed53de8a4bc22b130a711a41dd0 SHA512 42ede5ef4b872e50cf3b02a3d305fd25675172a4e4461a8072cace688c4935c77267106a53164420e9181437501bc241dd3413806fd1f65eb87ee5ca877455ed
+DIST glibc-systemd-20210727.tar.gz 1454 BLAKE2B 0383338f73cec9a13165f0be261eb3d46c0362425b5fe31846f0ec00da9aff69d941e8b0e0ad1f8691edf9dc30796c239e8e984207725e4cf98fd037e7168e22 SHA512 09a91f6351657abfca200d110b0a43d541399c2db142c5706e06b4eebb736932e8f1b026be8d844be64f8e2c981777c342004492ef99c3c81cb04bf75a2c3ee8
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff
 DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db

diff --git a/sys-libs/glibc/glibc-2.33-r4.ebuild b/sys-libs/glibc/glibc-2.33-r5.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.33-r4.ebuild
rename to sys-libs/glibc/glibc-2.33-r5.ebuild
index 8b26b1c9600..92983b53656 100644
--- a/sys-libs/glibc/glibc-2.33-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r5.ebuild
@@ -34,7 +34,7 @@ GCC_BOOTSTRAP_VER=20201208
 
 LOCALE_GEN_VER=2.10
 
-GLIBC_SYSTEMD_VER=20210724
+GLIBC_SYSTEMD_VER=20210727
 
 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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-27 20:27 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-07-27 20:27 UTC (permalink / raw
  To: gentoo-commits

commit:     b0487704b1313905307b65448bc082490c92f237
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 27 19:18:17 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jul 27 20:27:42 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b0487704

sys-libs/glibc: Drop old

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r3.ebuild | 1534 -----------------------------------
 1 file changed, 1534 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33-r3.ebuild b/sys-libs/glibc/glibc-2.33-r3.ebuild
deleted file mode 100644
index e424358c1e9..00000000000
--- a/sys-libs/glibc/glibc-2.33-r3.ebuild
+++ /dev/null
@@ -1,1534 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9,10} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=4
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-LOCALE_GEN_VER=2.10
-
-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 )"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
-}
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins posix/gai.conf nss/nsswitch.conf
-
-	# Gentoo-specific
-	newins "${FILESDIR}"/host.conf-1 host.conf
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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 has_version "${CATEGORY}/${PN}[crypt]"; then
-		PRESERVED_OLD_LIBCRYPT=1
-		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
-	else
-		PRESERVED_OLD_LIBCRYPT=0
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-
-	if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
-		preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-27 20:27 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-07-27 20:27 UTC (permalink / raw
  To: gentoo-commits

commit:     4f9777574be1a56128e802da06df7458165c2f47
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 27 20:26:23 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jul 27 20:27:45 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4f977757

sys-libs/glibc: Add workaround for the missing crypt.h problem

Bug: https://bugs.gentoo.org/802210
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r5.ebuild | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r5.ebuild b/sys-libs/glibc/glibc-2.33-r5.ebuild
index 92983b53656..8c7ab1e3d32 100644
--- a/sys-libs/glibc/glibc-2.33-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r5.ebuild
@@ -1502,9 +1502,10 @@ pkg_preinst() {
 	# 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 has_version "${CATEGORY}/${PN}[crypt]"; then
+	if ! use crypt && has_version "${CATEGORY}/${PN}[crypt]"; then
 		PRESERVED_OLD_LIBCRYPT=1
 		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
+		cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
 	else
 		PRESERVED_OLD_LIBCRYPT=0
 	fi
@@ -1540,5 +1541,10 @@ pkg_postinst() {
 
 	if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
 		preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
+		cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror "Error restoring crypt.h, please file a bug"
+		elog "Please ignore a possible later error message about a file collision involving"
+		elog "/usr/include/crypt.h. 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
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-27 20:33 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-07-27 20:33 UTC (permalink / raw
  To: gentoo-commits

commit:     ed0a52f68dbe4cb6c3a8c85e782a6abe9c30683f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 27 20:33:15 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jul 27 20:33:15 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ed0a52f6

sys-libs/glibc: Add crypt.h fixes also here

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 107ec16a0ba..99426d97e8c 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1510,9 +1510,10 @@ pkg_preinst() {
 	# 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 has_version "${CATEGORY}/${PN}[crypt]"; then
+	if ! use crypt && has_version "${CATEGORY}/${PN}[crypt]"; then
 		PRESERVED_OLD_LIBCRYPT=1
 		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
+		cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
 	else
 		PRESERVED_OLD_LIBCRYPT=0
 	fi
@@ -1548,5 +1549,10 @@ pkg_postinst() {
 
 	if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
 		preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
+		cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror "Error restoring crypt.h, please file a bug"
+		elog "Please ignore a possible later error message about a file collision involving"
+		elog "/usr/include/crypt.h. 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
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-07-29 16:51 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-07-29 16:51 UTC (permalink / raw
  To: gentoo-commits

commit:     e3e113d909c2ba213d033fad3e8e531f40e75122
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 29 16:51:28 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Jul 29 16:51:41 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e3e113d9

sys-libs/glibc: Add PAM fix to live ebuild

Bug: https://bugs.gentoo.org/803050
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index c26e786d2e4..f11db6a32c8 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,7 +17,7 @@ DIST glibc-2.33-patches-3.tar.xz 37076 BLAKE2B 718ab706df85c966145958fb6137b5499
 DIST glibc-2.33-patches-4.tar.xz 60124 BLAKE2B a7a99f39c16df241745772c31b10946dc44c51e6c09f8a447b905e7dd6ba529aee08f66a581431453c6665485ac1848861559aa3f0aaba8c2061c1f1eb77d9be SHA512 05c33dc465a98097f836783bb5037dfa14b3a2c0c140014f642ea72954222ae919fe2db9573ee70ca9c1881b3b59dd4b815a8f39f331494fa12951c9012797ef
 DIST glibc-2.33-patches-5.tar.xz 63032 BLAKE2B e7f5952b2d84dc264e960d8bd3d9af4ca43089ca269735168933e80a0a74d7be1cadc90935b429cfdf5f0052d3ce3482a8f073b15378e7f9c05034535d9eae4d SHA512 00c2f8f104e7899b76398a6a39f054cd109a71f5fcc4020304b7d7e15ae0c53df1c3acbafd56898427b3849452f9fb9e5064ff584d6c86c4d18c8a9201c89d29
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
-DIST glibc-systemd-20210724.tar.gz 1475 BLAKE2B 065bb4f364162ed168f9e777178ff2559f85db43c3585a45e63fda00dde34071674522cc2133d446c703737a36b1ba3148823ed53de8a4bc22b130a711a41dd0 SHA512 42ede5ef4b872e50cf3b02a3d305fd25675172a4e4461a8072cace688c4935c77267106a53164420e9181437501bc241dd3413806fd1f65eb87ee5ca877455ed
 DIST glibc-systemd-20210727.tar.gz 1454 BLAKE2B 0383338f73cec9a13165f0be261eb3d46c0362425b5fe31846f0ec00da9aff69d941e8b0e0ad1f8691edf9dc30796c239e8e984207725e4cf98fd037e7168e22 SHA512 09a91f6351657abfca200d110b0a43d541399c2db142c5706e06b4eebb736932e8f1b026be8d844be64f8e2c981777c342004492ef99c3c81cb04bf75a2c3ee8
+DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff
 DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 99426d97e8c..60bd75d08ac 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -35,7 +35,7 @@ GCC_BOOTSTRAP_VER=20201208
 
 LOCALE_GEN_VER=2.10
 
-GLIBC_SYSTEMD_VER=20210724
+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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-08-02 23:10 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-08-02 23:10 UTC (permalink / raw
  To: gentoo-commits

commit:     0f9a59264d9893e1975f850b60a06ebf9be80f38
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  2 23:10:15 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Aug  2 23:10:48 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0f9a5926

sys-libs/glibc: Version bump, no keywords

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          |    2 +
 sys-libs/glibc/glibc-2.34.ebuild | 1558 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 1560 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index f11db6a32c8..6aa50136720 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,6 +17,8 @@ DIST glibc-2.33-patches-3.tar.xz 37076 BLAKE2B 718ab706df85c966145958fb6137b5499
 DIST glibc-2.33-patches-4.tar.xz 60124 BLAKE2B a7a99f39c16df241745772c31b10946dc44c51e6c09f8a447b905e7dd6ba529aee08f66a581431453c6665485ac1848861559aa3f0aaba8c2061c1f1eb77d9be SHA512 05c33dc465a98097f836783bb5037dfa14b3a2c0c140014f642ea72954222ae919fe2db9573ee70ca9c1881b3b59dd4b815a8f39f331494fa12951c9012797ef
 DIST glibc-2.33-patches-5.tar.xz 63032 BLAKE2B e7f5952b2d84dc264e960d8bd3d9af4ca43089ca269735168933e80a0a74d7be1cadc90935b429cfdf5f0052d3ce3482a8f073b15378e7f9c05034535d9eae4d SHA512 00c2f8f104e7899b76398a6a39f054cd109a71f5fcc4020304b7d7e15ae0c53df1c3acbafd56898427b3849452f9fb9e5064ff584d6c86c4d18c8a9201c89d29
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
+DIST glibc-2.34-patches-1.tar.xz 7656 BLAKE2B e4ed403a10276a4ea468632b3f2baf31c8e7cd6c95a6f50fb6dd8f1196890e2ce5e66c878a67a3a28451d662b71ba67177d467f94a2161d3b13894eccbe54694 SHA512 d495a27c38eb685273e509d02b1c87e17b9908af9ff838925c34e0f2bcb063afb89e666eca1e5829edf91ffe41f4e70f66ed6cbd738b1df82ef6af4b3f99f502
+DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-systemd-20210727.tar.gz 1454 BLAKE2B 0383338f73cec9a13165f0be261eb3d46c0362425b5fe31846f0ec00da9aff69d941e8b0e0ad1f8691edf9dc30796c239e8e984207725e4cf98fd037e7168e22 SHA512 09a91f6351657abfca200d110b0a43d541399c2db142c5706e06b4eebb736932e8f1b026be8d844be64f8e2c981777c342004492ef99c3c81cb04bf75a2c3ee8
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff

diff --git a/sys-libs/glibc/glibc-2.34.ebuild b/sys-libs/glibc/glibc-2.34.ebuild
new file mode 100644
index 00000000000..e0e45501086
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.34.ebuild
@@ -0,0 +1,1558 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7,8,9,10} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=1
+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=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+LOCALE_GEN_VER=2.10
+
+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 systemd systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-1.3.3
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-1.3.3
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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
+		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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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 . -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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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]"; then
+		PRESERVED_OLD_LIBCRYPT=1
+		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
+		cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
+	else
+		PRESERVED_OLD_LIBCRYPT=0
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+
+	if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
+		preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
+		cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror "Error restoring crypt.h, please file a bug"
+		elog "Please ignore a possible later error message about a file collision involving"
+		elog "/usr/include/crypt.h. 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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-08-03 15:14 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-08-03 15:14 UTC (permalink / raw
  To: gentoo-commits

commit:     499941c3343bf335c4d836cf2e2cef3c02a2ee1d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  3 15:13:49 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Aug  3 15:14:13 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=499941c3

sys-libs/glibc: Require newer pax-utils (for scanelf)

See also
https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=25e4d53c70f2b677dcde1c37cb9c67214b38d611

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r5.ebuild | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33-r5.ebuild b/sys-libs/glibc/glibc-2.33-r5.ebuild
index 8c7ab1e3d32..c8c57855f2e 100644
--- a/sys-libs/glibc/glibc-2.33-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r5.ebuild
@@ -97,7 +97,7 @@ fi
 
 BDEPEND="
 	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
+	>=app-misc/pax-utils-1.3.3
 	sys-devel/bison
 	doc? ( sys-apps/texinfo )
 	!compile-locales? (
@@ -115,7 +115,6 @@ COMMON_DEPEND="
 	suid? ( caps? ( sys-libs/libcap ) )
 	selinux? ( sys-libs/libselinux )
 	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
 "
 DEPEND="${COMMON_DEPEND}
 	compile-locales? (
@@ -130,6 +129,8 @@ RDEPEND="${COMMON_DEPEND}
 	sys-apps/grep
 	virtual/awk
 	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-1.3.3
+	!<net-misc/openssh-8.1_p1-r2
 "
 
 RESTRICT="!test? ( test )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-08-03 15:23 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-08-03 15:23 UTC (permalink / raw
  To: gentoo-commits

commit:     5cde29d04e2da37ded900130f0f3dea13fcc350f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  3 15:23:15 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Aug  3 15:23:31 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5cde29d0

sys-libs/glibc: require pax-utils 1.3.1 for 2.33 instead

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r1.ebuild | 5 +++--
 sys-libs/glibc/glibc-2.33-r5.ebuild | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33-r1.ebuild b/sys-libs/glibc/glibc-2.33-r1.ebuild
index fe0ef6cbb24..bf657301512 100644
--- a/sys-libs/glibc/glibc-2.33-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r1.ebuild
@@ -94,7 +94,7 @@ fi
 
 BDEPEND="
 	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
+	>=app-misc/pax-utils-1.3.1
 	sys-devel/bison
 	doc? ( sys-apps/texinfo )
 	!compile-locales? (
@@ -112,7 +112,6 @@ COMMON_DEPEND="
 	suid? ( caps? ( sys-libs/libcap ) )
 	selinux? ( sys-libs/libselinux )
 	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
 "
 DEPEND="${COMMON_DEPEND}
 	compile-locales? (
@@ -127,6 +126,8 @@ RDEPEND="${COMMON_DEPEND}
 	sys-apps/grep
 	virtual/awk
 	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-1.3.1
+	!<net-misc/openssh-8.1_p1-r2
 "
 
 RESTRICT="!test? ( test )"

diff --git a/sys-libs/glibc/glibc-2.33-r5.ebuild b/sys-libs/glibc/glibc-2.33-r5.ebuild
index c8c57855f2e..65857001c42 100644
--- a/sys-libs/glibc/glibc-2.33-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r5.ebuild
@@ -97,7 +97,7 @@ fi
 
 BDEPEND="
 	${PYTHON_DEPS}
-	>=app-misc/pax-utils-1.3.3
+	>=app-misc/pax-utils-1.3.1
 	sys-devel/bison
 	doc? ( sys-apps/texinfo )
 	!compile-locales? (
@@ -129,7 +129,7 @@ RDEPEND="${COMMON_DEPEND}
 	sys-apps/grep
 	virtual/awk
 	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-1.3.3
+	!<app-misc/pax-utils-1.3.1
 	!<net-misc/openssh-8.1_p1-r2
 "
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-08-06 21:26 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-08-06 21:26 UTC (permalink / raw
  To: gentoo-commits

commit:     e7b0114164283c266d7a246b824dfe906881b93c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  6 21:25:52 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Aug  6 21:26:06 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e7b01141

sys-libs/glibc: Run compiler tests only when compiling

Bug: https://bugs.gentoo.org/786570
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.34.ebuild b/sys-libs/glibc/glibc-2.34.ebuild
index e0e45501086..b9c6d96cb9f 100644
--- a/sys-libs/glibc/glibc-2.34.ebuild
+++ b/sys-libs/glibc/glibc-2.34.ebuild
@@ -678,7 +678,7 @@ sanity_prechecks() {
 	fi
 
 	# When we actually have to compile something...
-	if ! just_headers ; then
+	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; then
 		ebegin "Checking gcc for __thread support"
 		if ! eend $(want__thread ; echo $?) ; then
 			echo

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 60bd75d08ac..564367df0b9 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -678,7 +678,7 @@ sanity_prechecks() {
 	fi
 
 	# When we actually have to compile something...
-	if ! just_headers ; then
+	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; then
 		ebegin "Checking gcc for __thread support"
 		if ! eend $(want__thread ; echo $?) ; then
 			echo


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-08-18 18:01 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-08-18 18:01 UTC (permalink / raw
  To: gentoo-commits

commit:     d09c3e96f6514b330e1806709421da5ff59caa9d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 18 17:57:10 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Aug 18 18:00:58 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d09c3e96

sys-libs/glibc: Remove old

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.33-r5.ebuild | 1551 -----------------------------------
 2 files changed, 1552 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 1bc957b0884..57d5da64065 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,7 +20,6 @@ DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf00
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-1.tar.xz 7656 BLAKE2B e4ed403a10276a4ea468632b3f2baf31c8e7cd6c95a6f50fb6dd8f1196890e2ce5e66c878a67a3a28451d662b71ba67177d467f94a2161d3b13894eccbe54694 SHA512 d495a27c38eb685273e509d02b1c87e17b9908af9ff838925c34e0f2bcb063afb89e666eca1e5829edf91ffe41f4e70f66ed6cbd738b1df82ef6af4b3f99f502
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
-DIST glibc-systemd-20210727.tar.gz 1454 BLAKE2B 0383338f73cec9a13165f0be261eb3d46c0362425b5fe31846f0ec00da9aff69d941e8b0e0ad1f8691edf9dc30796c239e8e984207725e4cf98fd037e7168e22 SHA512 09a91f6351657abfca200d110b0a43d541399c2db142c5706e06b4eebb736932e8f1b026be8d844be64f8e2c981777c342004492ef99c3c81cb04bf75a2c3ee8
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff

diff --git a/sys-libs/glibc/glibc-2.33-r5.ebuild b/sys-libs/glibc/glibc-2.33-r5.ebuild
deleted file mode 100644
index 65857001c42..00000000000
--- a/sys-libs/glibc/glibc-2.33-r5.ebuild
+++ /dev/null
@@ -1,1551 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9,10} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=5
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-LOCALE_GEN_VER=2.10
-
-GLIBC_SYSTEMD_VER=20210727
-
-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 systemd systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-1.3.1
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-1.3.1
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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]"; then
-		PRESERVED_OLD_LIBCRYPT=1
-		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
-		cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
-	else
-		PRESERVED_OLD_LIBCRYPT=0
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-
-	if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
-		preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
-		cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror "Error restoring crypt.h, please file a bug"
-		elog "Please ignore a possible later error message about a file collision involving"
-		elog "/usr/include/crypt.h. 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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-08-18 18:01 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-08-18 18:01 UTC (permalink / raw
  To: gentoo-commits

commit:     7fb14f0b1a2d1e590437487be9a6a2c278aafd60
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 18 18:00:28 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Aug 18 18:01:02 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7fb14f0b

sys-libs/glibc: Bump 2.34 patchlevel to 2 (unkeyworded)

Bug: https://bugs.gentoo.org/807935
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-2.34.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 57d5da64065..6c1d47a0bae 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,7 +18,7 @@ DIST glibc-2.33-patches-4.tar.xz 60124 BLAKE2B a7a99f39c16df241745772c31b10946dc
 DIST glibc-2.33-patches-5.tar.xz 63032 BLAKE2B e7f5952b2d84dc264e960d8bd3d9af4ca43089ca269735168933e80a0a74d7be1cadc90935b429cfdf5f0052d3ce3482a8f073b15378e7f9c05034535d9eae4d SHA512 00c2f8f104e7899b76398a6a39f054cd109a71f5fcc4020304b7d7e15ae0c53df1c3acbafd56898427b3849452f9fb9e5064ff584d6c86c4d18c8a9201c89d29
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
-DIST glibc-2.34-patches-1.tar.xz 7656 BLAKE2B e4ed403a10276a4ea468632b3f2baf31c8e7cd6c95a6f50fb6dd8f1196890e2ce5e66c878a67a3a28451d662b71ba67177d467f94a2161d3b13894eccbe54694 SHA512 d495a27c38eb685273e509d02b1c87e17b9908af9ff838925c34e0f2bcb063afb89e666eca1e5829edf91ffe41f4e70f66ed6cbd738b1df82ef6af4b3f99f502
+DIST glibc-2.34-patches-2.tar.xz 13156 BLAKE2B 9f761868085cc752d396df097a256dfeb5824cf2fec4e5cd122d51b282367407e847e9e106a031fd44d3bc0a15a17014dd896949b147fea551b1b4be4c9aa8e7 SHA512 c5713c26209664d8e5ddccd8520db45368fb974a27293b720ded7bdbae6e6f63a75a3ce439961cc0e11a933d0c6510b90096781d9ea3181d513b0d142a881d1c
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.34.ebuild b/sys-libs/glibc/glibc-2.34.ebuild
index b9c6d96cb9f..cacddc9065e 100644
--- a/sys-libs/glibc/glibc-2.34.ebuild
+++ b/sys-libs/glibc/glibc-2.34.ebuild
@@ -17,7 +17,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=1
+PATCH_VER=2
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-08-18 18:01 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-08-18 18:01 UTC (permalink / raw
  To: gentoo-commits

commit:     8c150cdb5bc5d9fc84079cc764957b7823c3bf43
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 18 17:56:02 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Aug 18 18:00:55 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c150cdb

sys-libs/glibc: 2.33 revision/patchlevel 6 bump

Bug: https://bugs.gentoo.org/807935
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28213
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.33-r7.ebuild | 1551 +++++++++++++++++++++++++++++++++++
 2 files changed, 1552 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index c6e62e2d2c2..1bc957b0884 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,6 +16,7 @@ DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6
 DIST glibc-2.33-patches-3.tar.xz 37076 BLAKE2B 718ab706df85c966145958fb6137b5499c1989ff27a62c22beaabd530d641e4937e6d6ab0cf00052b649dc99c3acc319997640eef95669235dab864f5e0afc9f SHA512 6d460976610a1c3bd3dabee9250008b5b3024ba486d598f85bc81cbd0b88188d125714b93a8b253f9b59b292e998f35118562e2a3ca90c418ff14fa53af2a7c3
 DIST glibc-2.33-patches-4.tar.xz 60124 BLAKE2B a7a99f39c16df241745772c31b10946dc44c51e6c09f8a447b905e7dd6ba529aee08f66a581431453c6665485ac1848861559aa3f0aaba8c2061c1f1eb77d9be SHA512 05c33dc465a98097f836783bb5037dfa14b3a2c0c140014f642ea72954222ae919fe2db9573ee70ca9c1881b3b59dd4b815a8f39f331494fa12951c9012797ef
 DIST glibc-2.33-patches-5.tar.xz 63032 BLAKE2B e7f5952b2d84dc264e960d8bd3d9af4ca43089ca269735168933e80a0a74d7be1cadc90935b429cfdf5f0052d3ce3482a8f073b15378e7f9c05034535d9eae4d SHA512 00c2f8f104e7899b76398a6a39f054cd109a71f5fcc4020304b7d7e15ae0c53df1c3acbafd56898427b3849452f9fb9e5064ff584d6c86c4d18c8a9201c89d29
+DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-1.tar.xz 7656 BLAKE2B e4ed403a10276a4ea468632b3f2baf31c8e7cd6c95a6f50fb6dd8f1196890e2ce5e66c878a67a3a28451d662b71ba67177d467f94a2161d3b13894eccbe54694 SHA512 d495a27c38eb685273e509d02b1c87e17b9908af9ff838925c34e0f2bcb063afb89e666eca1e5829edf91ffe41f4e70f66ed6cbd738b1df82ef6af4b3f99f502
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild b/sys-libs/glibc/glibc-2.33-r7.ebuild
new file mode 100644
index 00000000000..2f9ce004d3a
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.33-r7.ebuild
@@ -0,0 +1,1551 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7,8,9,10} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=6
+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"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+LOCALE_GEN_VER=2.10
+
+GLIBC_SYSTEMD_VER=20210814
+
+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 systemd systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-1.3.1
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-1.3.1
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; 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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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
+		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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (e.g. /var/tmp/portage:${HOSTNAME})
+	pushd "${ED}"/$(get_libdir) >/dev/null
+
+	local x striptest
+	for x in cal date env free ls true uname uptime ; do
+		x=$(type -p ${x})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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]"; then
+		PRESERVED_OLD_LIBCRYPT=1
+		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
+		cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
+	else
+		PRESERVED_OLD_LIBCRYPT=0
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			fi
+		done
+	fi
+
+	if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
+		preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
+		cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror "Error restoring crypt.h, please file a bug"
+		elog "Please ignore a possible later error message about a file collision involving"
+		elog "/usr/include/crypt.h. 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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-08-30 17:37 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-08-30 17:37 UTC (permalink / raw
  To: gentoo-commits

commit:     83eba907fb556cea8ec71c2b4d4c4c300ebd68e7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 30 17:36:17 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 30 17:36:17 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=83eba907

sys-libs/glibc: Stabilize 2.33-r1 ppc, #792261

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r1.ebuild b/sys-libs/glibc/glibc-2.33-r1.ebuild
index bf657301512..cdbca06cc5d 100644
--- a/sys-libs/glibc/glibc-2.33-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r1.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-09-02 15:26 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-09-02 15:26 UTC (permalink / raw
  To: gentoo-commits

commit:     486b77ab8d28c5bfd5a4bdfc5f9a5f432ffde563
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Sep  2 15:25:43 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Sep  2 15:26:17 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=486b77ab

sys-libs/glibc: Drop old 2.25

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |   2 -
 sys-libs/glibc/glibc-2.25-r11.ebuild | 170 -----------------------------------
 sys-libs/glibc/metadata.xml          |   1 -
 3 files changed, 173 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 6c1d47a0bae..f0552009708 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -4,8 +4,6 @@ DIST gcc-multilib-bootstrap-20180511.tar.xz 2392908 BLAKE2B f3cf614399368acd8908
 DIST gcc-multilib-bootstrap-20201208.tar.xz 5528452 BLAKE2B 16699a6e4df5b2f28a21776ae9e3728b26a9ea251f5580aa5349545ad7c9f6145b9cb6a12ca8f5f96b9cb2a3c70b7e66ca702e4c6f083ac00408e0a20a69e613 SHA512 a243f505e17d0a7e144e8713c077582412f61d6cf7f79baa846de4fb77f5e0f27e11c9a785e14624e04ac52287b32164e7995323aa11caef59113ac438254347
 DIST glibc-2.19-patches-9.tar.bz2 24584 BLAKE2B a96e930a5bd20fa75d9f259cc2117fa5ce98072274a24a5823bf877e3739fa4c001a94d7865e065ee0527f3974430d27da8038e042340a451ad2052c62724f26 SHA512 a95b3063ade974a3556480b798b317d33c7423a8cb9e69f67249ffb8b3d3c671d70d2d5f782c1efadc0bec4cc49a96d4fe89911f3dfcd85b459f69f3b4f38f0e
 DIST glibc-2.19.tar.xz 12083312 BLAKE2B 9dc03346e0f0df4bf009a92d894b0a9f964ff92b7f4c9663cedf1cb6cf90435f28a15539d33791ecf43ee578fa4e26f916af0367651312ef8f9c1c38ce0dafa2 SHA512 9e021fcb3afbb9ace2a0e37fded231a62de861bd766e29d47163a03182e37add718b7acc3963d1c525f9556773e842297725715acde48dcfbaab6e756af1a23d
-DIST glibc-2.25-patches-15.tar.bz2 78320 BLAKE2B 70c62cc10db13e2844de4d8a18972e0f4d01ba52fbd40db57c11d7b1c2c0d571b894f01e762bb26632fd696a77c299ef0766e2f129d2eda896f58325a754a13c SHA512 7204218ea82b677e0f278c4752ddb90aa0c08ac2349d061de81ec91dac204b0f10fe223d7b1055b9e0c21dac97c835f913a90c0168a5000d3be00dd20027c185
-DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
 DIST glibc-2.30-patches-10.tar.xz 72808 BLAKE2B a7a95c99482524b2896d15539766f1e6b1fe34a22f32119248c6dd44f42632076e86fdcbbdc2d604ec73ceccdd8a7f5936a62a6f4c3d039fae8f6901dfc6be77 SHA512 af5e213ff08bf38f6f529816c36b4e38df27207c2df254609ebe45b2f039ab553bbe563aa6f64b6667d328fd2c120dc21b6e2676540bdd94e58079237089eac3
 DIST glibc-2.30-sparc-reg-fix-clobber.patch 6106 BLAKE2B cad6a4cbef5d529519ef486f4ef8e189cb4d43dd67fa8f8d50d67072cbb682f60474d482a5c5152d1317de92b98851d8a88eee6b331eb5bc22de065c03c58fde SHA512 a018ef1f196257f3888af20a5cbc97892c8382a4f489da042568e087c077f30cf4dda6ac711b573e1274317866ce97cf817d92a28cf55f18f5e8d32787e6cb3f
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b

diff --git a/sys-libs/glibc/glibc-2.25-r11.ebuild b/sys-libs/glibc/glibc-2.25-r11.ebuild
deleted file mode 100644
index 145e3601f82..00000000000
--- a/sys-libs/glibc/glibc-2.25-r11.ebuild
+++ /dev/null
@@ -1,170 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit epatch toolchain-funcs toolchain-glibc
-
-DESCRIPTION="GNU libc6 (also called glibc2) C library"
-HOMEPAGE="https://www.gnu.org/software/libc/libc.html"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86"
-EMULTILIB_PKG="true"
-
-# Configuration variables
-RELEASE_VER=""
-case ${PV} in
-9999*)
-	EGIT_REPO_URIS="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-	;;
-*)
-	RELEASE_VER=${PV}
-	;;
-esac
-GCC_BOOTSTRAP_VER="4.7.3-r1"
-# patches live at https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/
-PATCH_VER="15"                                 # Gentoo patchset
-: ${NPTL_KERN_VER:="2.6.32"}                   # min kernel version nptl requires
-
-GLIBC_PATCH_EXCLUDE+=" 0005_all_sys-types.h-drop-sys-sysmacros.h-include.patch"
-
-IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla headers-only"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we disable stripping
-# entirely.
-RESTRICT=strip
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-# Why SLOT 2.2 you ask yourself while sippin your tea ?
-# Everyone knows 2.2 > 0, duh.
-SLOT="2.2"
-
-# General: We need a new-enough binutils/gcc to match upstream baseline.
-# arch: we need to make sure our binutils/gcc supports TLS.
-COMMON_DEPEND="
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	>=app-misc/pax-utils-0.1.10
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	DEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-4.7
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	DEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-4.7
-		virtual/os-headers"
-	RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-upstream_uris() {
-	echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
-}
-gentoo_uris() {
-	local devspace="HTTP~vapier/dist/URI HTTP~dilfridge/distfiles/URI HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
-	devspace=${devspace//HTTP/https://dev.gentoo.org/}
-	echo mirror://gentoo/$1 ${devspace//URI/$1}
-}
-SRC_URI=$(
-	[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
-	[[ -n ${PATCH_VER}      ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
-)
-SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
-
-src_unpack() {
-	[[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
-
-	toolchain-glibc_src_unpack
-}
-
-src_prepare() {
-	toolchain-glibc_src_prepare
-
-	cd "${S}"
-
-	epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838
-
-	if use hardened ; then
-		# We don't enable these for non-hardened as the output is very terse --
-		# it only states that a crash happened.  The default upstream behavior
-		# includes backtraces and symbols.
-		einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
-		cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
-		cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
-
-		if use debug ; then
-			# Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
-			sed -i \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				-e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
-				debug/Makefile || die
-		fi
-	fi
-
-	case $(gcc-fullversion) in
-	4.8.[0-3]|4.9.0)
-		eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
-		eerror "glibc.  See https://bugs.gentoo.org/547420 for details."
-		die "need to switch compilers #547420"
-		;;
-	esac
-}

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index 7dc64b63dde..46756d4a46e 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -14,7 +14,6 @@
  <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="nscd">Build, and enable support for, the Name Service Cache Daemon</flag>
- <flag name="rpc">Enable obsolete RPC/NIS layers</flag>
  <flag name="ssp">protect stack of glibc internals</flag>
  <flag name="static-pie">Enable static PIE support (runtime files for -static-pie gcc option).</flag>
  <flag name="suid">Make internal pt_chown helper setuid -- not needed if using Linux and have /dev/pts mounted with gid=5</flag>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-09-05  5:48 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-09-05  5:48 UTC (permalink / raw
  To: gentoo-commits

commit:     dc67add1a5356531eaaec698807661461abc27e4
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  5 05:28:55 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Sep  5 05:47:47 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dc67add1

sys-libs/glibc: add comment on bumping pax-utils bound

It's important that we remember to do this when bumping
glibc releases. Added a comment as a reminder and used
a variable so that both uses are consistent within *DEPEND.

Bug: https://bugs.gentoo.org/811462
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34.ebuild |  7 +++++--
 sys-libs/glibc/glibc-9999.ebuild | 11 +++++++----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.34.ebuild b/sys-libs/glibc/glibc-2.34.ebuild
index cacddc9065e..0466160c931 100644
--- a/sys-libs/glibc/glibc-2.34.ebuild
+++ b/sys-libs/glibc/glibc-2.34.ebuild
@@ -45,6 +45,9 @@ IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +m
 
 # 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
@@ -98,7 +101,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? (
@@ -130,7 +133,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
 "
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 564367df0b9..0466160c931 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -17,8 +17,8 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=16
-PATCH_DEV=slyfox
+PATCH_VER=2
+PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
@@ -45,6 +45,9 @@ IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +m
 
 # 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
@@ -98,7 +101,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? (
@@ -130,7 +133,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
 "
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-09-08 23:48 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-09-08 23:48 UTC (permalink / raw
  To: gentoo-commits

commit:     1ee6e5850273f238a83f71426d60f08c48d32659
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Sep  8 23:47:24 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Sep  8 23:48:07 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1ee6e585

sys-libs/glibc: add comment referencing wiki page

.. to refer to a list of things to do when bumping
glibc.

Bug: https://bugs.gentoo.org/811462
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34.ebuild | 3 +++
 sys-libs/glibc/glibc-9999.ebuild | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.34.ebuild b/sys-libs/glibc/glibc-2.34.ebuild
index 0466160c931..459c54eacc9 100644
--- a/sys-libs/glibc/glibc-2.34.ebuild
+++ b/sys-libs/glibc/glibc-2.34.ebuild
@@ -3,6 +3,9 @@
 
 EAPI=7
 
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
 PYTHON_COMPAT=( python3_{7,8,9,10} )
 TMPFILES_OPTIONAL=1
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 0466160c931..459c54eacc9 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -3,6 +3,9 @@
 
 EAPI=7
 
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
 PYTHON_COMPAT=( python3_{7,8,9,10} )
 TMPFILES_OPTIONAL=1
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-09-25 19:21 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-09-25 19:21 UTC (permalink / raw
  To: gentoo-commits

commit:     dce5d703f13d495e880ac1dcb7624c31bcc26368
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 25 19:20:51 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Sep 25 19:21:22 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dce5d703

sys-libs/glibc: Update 2.34 to patchset 3

Package-Manager: Portage-3.0.23, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-2.34.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index f0552009708..78220f0644a 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,7 +16,7 @@ DIST glibc-2.33-patches-4.tar.xz 60124 BLAKE2B a7a99f39c16df241745772c31b10946dc
 DIST glibc-2.33-patches-5.tar.xz 63032 BLAKE2B e7f5952b2d84dc264e960d8bd3d9af4ca43089ca269735168933e80a0a74d7be1cadc90935b429cfdf5f0052d3ce3482a8f073b15378e7f9c05034535d9eae4d SHA512 00c2f8f104e7899b76398a6a39f054cd109a71f5fcc4020304b7d7e15ae0c53df1c3acbafd56898427b3849452f9fb9e5064ff584d6c86c4d18c8a9201c89d29
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
-DIST glibc-2.34-patches-2.tar.xz 13156 BLAKE2B 9f761868085cc752d396df097a256dfeb5824cf2fec4e5cd122d51b282367407e847e9e106a031fd44d3bc0a15a17014dd896949b147fea551b1b4be4c9aa8e7 SHA512 c5713c26209664d8e5ddccd8520db45368fb974a27293b720ded7bdbae6e6f63a75a3ce439961cc0e11a933d0c6510b90096781d9ea3181d513b0d142a881d1c
+DIST glibc-2.34-patches-3.tar.xz 32984 BLAKE2B 5632cbb94bb6134348eebf545d2e1e8895edb318d2bbd4b5ff6847ca498a00814b47d6201915b3774906a125a46bcbd704f0c4b94a97eeaca4f7b89d9e93f7e4 SHA512 2c0ce3bba19a0585a869e98e63d14943655eeb40a11f1c70109781580d0de37269f44b99f0e366cd5d6a974ace668e953b66db77561152d683a30e14d8a13677
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.34.ebuild b/sys-libs/glibc/glibc-2.34.ebuild
index 459c54eacc9..ec8811d086a 100644
--- a/sys-libs/glibc/glibc-2.34.ebuild
+++ b/sys-libs/glibc/glibc-2.34.ebuild
@@ -20,7 +20,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=2
+PATCH_VER=3
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-10-01  7:14 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-10-01  7:14 UTC (permalink / raw
  To: gentoo-commits

commit:     314fd594b6d5d56b5fe556182b068fb137c289eb
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  1 07:13:27 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct  1 07:13:27 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=314fd594

sys-libs/glibc: update SRC_URI

slyfox@ has retired and I've archived the distfiles
in my devspace.

Package-Manager: Portage-3.0.26, Repoman-3.0.3
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.30-r9.ebuild b/sys-libs/glibc/glibc-2.30-r9.ebuild
index c914722d46b..88282a7f595 100644
--- a/sys-libs/glibc/glibc-2.30-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r9.ebuild
@@ -34,7 +34,7 @@ PATCH_DEV=dilfridge
 
 SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/glibc-2.30-sparc-reg-fix-clobber.patch"
+SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/glibc-2.30-sparc-reg-fix-clobber.patch"
 
 IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-10-29 17:07 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-10-29 17:07 UTC (permalink / raw
  To: gentoo-commits

commit:     ae943e7f2e7188209d92bdfe5149e8883112accd
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 29 17:07:09 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Oct 29 17:07:23 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ae943e7f

sys-libs/glibc: Bump 2.34 to patchset 4

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-2.34.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 78220f0644a..121cfa20219 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,7 +16,7 @@ DIST glibc-2.33-patches-4.tar.xz 60124 BLAKE2B a7a99f39c16df241745772c31b10946dc
 DIST glibc-2.33-patches-5.tar.xz 63032 BLAKE2B e7f5952b2d84dc264e960d8bd3d9af4ca43089ca269735168933e80a0a74d7be1cadc90935b429cfdf5f0052d3ce3482a8f073b15378e7f9c05034535d9eae4d SHA512 00c2f8f104e7899b76398a6a39f054cd109a71f5fcc4020304b7d7e15ae0c53df1c3acbafd56898427b3849452f9fb9e5064ff584d6c86c4d18c8a9201c89d29
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
-DIST glibc-2.34-patches-3.tar.xz 32984 BLAKE2B 5632cbb94bb6134348eebf545d2e1e8895edb318d2bbd4b5ff6847ca498a00814b47d6201915b3774906a125a46bcbd704f0c4b94a97eeaca4f7b89d9e93f7e4 SHA512 2c0ce3bba19a0585a869e98e63d14943655eeb40a11f1c70109781580d0de37269f44b99f0e366cd5d6a974ace668e953b66db77561152d683a30e14d8a13677
+DIST glibc-2.34-patches-4.tar.xz 49256 BLAKE2B fa25745eab668932cec66cd77e1fe98f7f80af00841626741087c210fbe59523a8d76b9b40214e7a67b1a53267a990a0c90de7dd7da8590c6517aa0fb58c51bb SHA512 8afef6fc24e5eb32b063c7811e8aadb8f4c6548500e8c1a90787b1810deed1e176468477730f6ce6ae4523decf0acce7a36711cdd001666fa6b7d8d83af6347b
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.34.ebuild b/sys-libs/glibc/glibc-2.34.ebuild
index ec8811d086a..e3957644385 100644
--- a/sys-libs/glibc/glibc-2.34.ebuild
+++ b/sys-libs/glibc/glibc-2.34.ebuild
@@ -20,7 +20,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=3
+PATCH_VER=4
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-10-30 15:42 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-10-30 15:42 UTC (permalink / raw
  To: gentoo-commits

commit:     355dda138053b905004c5f9d70233b627cb9c857
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 30 15:42:14 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 30 15:42:31 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=355dda13

sys-libs/glibc: Remove old

Bug: https://bugs.gentoo.org/792261
Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 -
 sys-libs/glibc/glibc-2.33-r6.ebuild | 1551 -----------------------------------
 sys-libs/glibc/glibc-2.33.ebuild    | 1494 ---------------------------------
 3 files changed, 3047 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 121cfa20219..8c4e334efa7 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -11,9 +11,7 @@ DIST glibc-2.31-patches-9.tar.xz 74712 BLAKE2B 62991b67de4def4cca944e8420d2f0139
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a65f06b22fc5a04aa631b76b3016842365006399715531ee693f3519720edcebef7884247f2f8c19e3518c1ddafab7cc SHA512 5240bc3a6df46d12c03ea4ce7b1a0df85301256ae3bd003fd04c61dadaaec34998873bf20544d891f6eedf896302bb916010aebc1d8d646a3cce09a93b533d0b
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
-DIST glibc-2.33-patches-3.tar.xz 37076 BLAKE2B 718ab706df85c966145958fb6137b5499c1989ff27a62c22beaabd530d641e4937e6d6ab0cf00052b649dc99c3acc319997640eef95669235dab864f5e0afc9f SHA512 6d460976610a1c3bd3dabee9250008b5b3024ba486d598f85bc81cbd0b88188d125714b93a8b253f9b59b292e998f35118562e2a3ca90c418ff14fa53af2a7c3
 DIST glibc-2.33-patches-4.tar.xz 60124 BLAKE2B a7a99f39c16df241745772c31b10946dc44c51e6c09f8a447b905e7dd6ba529aee08f66a581431453c6665485ac1848861559aa3f0aaba8c2061c1f1eb77d9be SHA512 05c33dc465a98097f836783bb5037dfa14b3a2c0c140014f642ea72954222ae919fe2db9573ee70ca9c1881b3b59dd4b815a8f39f331494fa12951c9012797ef
-DIST glibc-2.33-patches-5.tar.xz 63032 BLAKE2B e7f5952b2d84dc264e960d8bd3d9af4ca43089ca269735168933e80a0a74d7be1cadc90935b429cfdf5f0052d3ce3482a8f073b15378e7f9c05034535d9eae4d SHA512 00c2f8f104e7899b76398a6a39f054cd109a71f5fcc4020304b7d7e15ae0c53df1c3acbafd56898427b3849452f9fb9e5064ff584d6c86c4d18c8a9201c89d29
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-4.tar.xz 49256 BLAKE2B fa25745eab668932cec66cd77e1fe98f7f80af00841626741087c210fbe59523a8d76b9b40214e7a67b1a53267a990a0c90de7dd7da8590c6517aa0fb58c51bb SHA512 8afef6fc24e5eb32b063c7811e8aadb8f4c6548500e8c1a90787b1810deed1e176468477730f6ce6ae4523decf0acce7a36711cdd001666fa6b7d8d83af6347b

diff --git a/sys-libs/glibc/glibc-2.33-r6.ebuild b/sys-libs/glibc/glibc-2.33-r6.ebuild
deleted file mode 100644
index 53507027d87..00000000000
--- a/sys-libs/glibc/glibc-2.33-r6.ebuild
+++ /dev/null
@@ -1,1551 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9,10} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=5
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-LOCALE_GEN_VER=2.10
-
-GLIBC_SYSTEMD_VER=20210814
-
-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 systemd systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-1.3.1
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-1.3.1
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; 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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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]"; then
-		PRESERVED_OLD_LIBCRYPT=1
-		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
-		cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
-	else
-		PRESERVED_OLD_LIBCRYPT=0
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-
-	if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
-		preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
-		cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror "Error restoring crypt.h, please file a bug"
-		elog "Please ignore a possible later error message about a file collision involving"
-		elog "/usr/include/crypt.h. 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
-}

diff --git a/sys-libs/glibc/glibc-2.33.ebuild b/sys-libs/glibc/glibc-2.33.ebuild
deleted file mode 100644
index c97ef6b4c66..00000000000
--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ /dev/null
@@ -1,1494 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9,10} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=3
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-LOCALE_GEN_VER=2.10
-
-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 )"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-	!<net-misc/openssh-8.1_p1-r2
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
-}
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins posix/gai.conf nss/nsswitch.conf
-
-	# Gentoo-specific
-	newins "${FILESDIR}"/host.conf-1 host.conf
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# https://bugs.gentoo.org/753740
-		rm "${EROOT}"/usr/lib/locale || die
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-10-30 15:50 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-10-30 15:50 UTC (permalink / raw
  To: gentoo-commits

commit:     01d429402c527a2f611b4faa105579ec81f66fcb
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 30 15:50:02 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 30 15:50:02 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=01d42940

sys-libs/glibc: Bump locale-gen version in 2.34 and later

Bug: https://bugs.gentoo.org/779790
Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 1 +
 sys-libs/glibc/glibc-2.34.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 8c4e334efa7..86427e09e86 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,3 +20,4 @@ DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff
 DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db
+DIST locale-gen-2.22.tar.gz 7971 BLAKE2B 2dc66fa69bf51799d0c34459b654fba6998b80a7e322e9b670036c967e269ad921f50195e6e34c4a83c1f0bad191fd5aa3f37defb82271b73acbca07b7e49d08 SHA512 9798b10dbbc792345a7b7a121dec5f4bba9839a8aec010f01a09f3402fd5bf2376f79e03a6a19bc357010db780037a8811c381136ce19be1f1370374906dff38

diff --git a/sys-libs/glibc/glibc-2.34.ebuild b/sys-libs/glibc/glibc-2.34.ebuild
index e3957644385..0a5f70fd284 100644
--- a/sys-libs/glibc/glibc-2.34.ebuild
+++ b/sys-libs/glibc/glibc-2.34.ebuild
@@ -36,7 +36,7 @@ RELEASE_VER=${PV}
 
 GCC_BOOTSTRAP_VER=20201208
 
-LOCALE_GEN_VER=2.10
+LOCALE_GEN_VER=2.22
 
 GLIBC_SYSTEMD_VER=20210729
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 459c54eacc9..7be3669c52a 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -36,7 +36,7 @@ RELEASE_VER=${PV}
 
 GCC_BOOTSTRAP_VER=20201208
 
-LOCALE_GEN_VER=2.10
+LOCALE_GEN_VER=2.22
 
 GLIBC_SYSTEMD_VER=20210729
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-10-31 18:10 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-10-31 18:10 UTC (permalink / raw
  To: gentoo-commits

commit:     f5066d076cfce41879c69515289e344ca676f674
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 31 18:10:25 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 31 18:10:25 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f5066d07

sys-libs/glibc: Stabilize 2.33-r7 amd64, #809410

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild b/sys-libs/glibc/glibc-2.33-r7.ebuild
index 4adf73d3c33..45cf87dfbd3 100644
--- a/sys-libs/glibc/glibc-2.33-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r7.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-10-31 18:10 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-10-31 18:10 UTC (permalink / raw
  To: gentoo-commits

commit:     c9337d9e1e19ad3a3de816a8abfbb94591be436e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 31 18:10:11 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 31 18:10:11 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c9337d9e

sys-libs/glibc: Stabilize 2.33-r7 arm, #809410

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild b/sys-libs/glibc/glibc-2.33-r7.ebuild
index 2f9ce004d3a..645fa1bc4ea 100644
--- a/sys-libs/glibc/glibc-2.33-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r7.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-10-31 18:10 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-10-31 18:10 UTC (permalink / raw
  To: gentoo-commits

commit:     700813dd5d12147e8e933dd12dd3d2cb82e4a40f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 31 18:10:17 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 31 18:10:17 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=700813dd

sys-libs/glibc: Stabilize 2.33-r7 arm64, #809410

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild b/sys-libs/glibc/glibc-2.33-r7.ebuild
index 645fa1bc4ea..4adf73d3c33 100644
--- a/sys-libs/glibc/glibc-2.33-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r7.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-10-31 18:12 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-10-31 18:12 UTC (permalink / raw
  To: gentoo-commits

commit:     e77f555b11b4ca3731f064ba30e8cae4a4b0a1f5
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 31 18:11:56 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 31 18:11:56 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e77f555b

sys-libs/glibc: Stabilize 2.33-r7 x86, #809410

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild b/sys-libs/glibc/glibc-2.33-r7.ebuild
index 45cf87dfbd3..8ff28d6b439 100644
--- a/sys-libs/glibc/glibc-2.33-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r7.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-10-31 18:12 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-10-31 18:12 UTC (permalink / raw
  To: gentoo-commits

commit:     b01f8ba50bd1bf5fd14cf8d586faea45f7ff33e6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 31 18:12:02 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 31 18:12:02 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b01f8ba5

sys-libs/glibc: Stabilize 2.33-r7 ppc, #809410

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild b/sys-libs/glibc/glibc-2.33-r7.ebuild
index 8ff28d6b439..ca3c3b58fb2 100644
--- a/sys-libs/glibc/glibc-2.33-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r7.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-10-31 18:12 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-10-31 18:12 UTC (permalink / raw
  To: gentoo-commits

commit:     b08411ffa790584ce9f68583b3d73961097670b7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 31 18:12:08 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 31 18:12:08 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b08411ff

sys-libs/glibc: Stabilize 2.33-r7 ppc64, #809410

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild b/sys-libs/glibc/glibc-2.33-r7.ebuild
index ca3c3b58fb2..4a0a39c71eb 100644
--- a/sys-libs/glibc/glibc-2.33-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r7.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-10-31 19:18 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-10-31 19:18 UTC (permalink / raw
  To: gentoo-commits

commit:     5a0fe43a6d8285569b9545ae061ffae26688e1e7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 31 19:18:06 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 31 19:18:06 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a0fe43a

sys-libs/glibc: mention collision-protect issue

Bug: https://bugs.gentoo.org/802210
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r7.ebuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild b/sys-libs/glibc/glibc-2.33-r7.ebuild
index 4a0a39c71eb..dbea0d35d4d 100644
--- a/sys-libs/glibc/glibc-2.33-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r7.ebuild
@@ -1547,5 +1547,6 @@ pkg_postinst() {
 		elog "/usr/include/crypt.h. 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."
+		elog "If you have FEATURES=collision-protect, please use FEATURES=unmerge-orphans instead!"
 	fi
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-11-03  0:54 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-11-03  0:54 UTC (permalink / raw
  To: gentoo-commits

commit:     3062f2ce92ef51f40385300dc9d3a3ec176bb9c6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Nov  3 00:53:29 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov  3 00:54:12 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3062f2ce

sys-libs/glibc: only copy crypt.h if it exists

Some folks may have rather strict INSTALL_MASKs and such
and don't need headers, so if they don't have it already,
go with it.

Bug: https://bugs.gentoo.org/802207
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r7.ebuild | 15 +++++++++++++--
 sys-libs/glibc/glibc-2.34.ebuild    | 16 ++++++++++++++--
 sys-libs/glibc/glibc-9999.ebuild    | 15 +++++++++++++--
 3 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild b/sys-libs/glibc/glibc-2.33-r7.ebuild
index dbea0d35d4d..146cce876a7 100644
--- a/sys-libs/glibc/glibc-2.33-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r7.ebuild
@@ -1506,7 +1506,12 @@ pkg_preinst() {
 	if ! use crypt && has_version "${CATEGORY}/${PN}[crypt]"; then
 		PRESERVED_OLD_LIBCRYPT=1
 		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
-		cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
+
+		# Only copy if it exists; some people may have tiny embedded
+		# systems without headers: https://bugs.gentoo.org/802207#c16.
+		if [[ -f "${EROOT}"/usr/include/crypt.h ]] ; then
+			cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
+		fi
 	else
 		PRESERVED_OLD_LIBCRYPT=0
 	fi
@@ -1542,7 +1547,13 @@ pkg_postinst() {
 
 	if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
 		preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
-		cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror "Error restoring crypt.h, please file a bug"
+
+		# Only copy if it exists; some people may have tiny embedded
+		# systems without headers: https://bugs.gentoo.org/802207#c16
+		if [[ -f "${T}"/crypt.h ]] ; then
+			cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror "Error restoring crypt.h, please file a bug"
+		fi
+
 		elog "Please ignore a possible later error message about a file collision involving"
 		elog "/usr/include/crypt.h. We need to preserve this file for the moment to keep"
 		elog "the upgrade working, but it also needs to be overwritten when"

diff --git a/sys-libs/glibc/glibc-2.34.ebuild b/sys-libs/glibc/glibc-2.34.ebuild
index 0a5f70fd284..f292dc31fc3 100644
--- a/sys-libs/glibc/glibc-2.34.ebuild
+++ b/sys-libs/glibc/glibc-2.34.ebuild
@@ -1519,7 +1519,13 @@ pkg_preinst() {
 	if ! use crypt && has_version "${CATEGORY}/${PN}[crypt]"; then
 		PRESERVED_OLD_LIBCRYPT=1
 		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
-		cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
+
+		# Only copy if it exists; some people may have tiny embedded
+		# systems without headers: https://bugs.gentoo.org/802207#c16
+		if [[ -f "${EROOT}"/usr/include/crypt.h ]] ; then
+			cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
+		fi
+
 	else
 		PRESERVED_OLD_LIBCRYPT=0
 	fi
@@ -1555,7 +1561,13 @@ pkg_postinst() {
 
 	if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
 		preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
-		cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror "Error restoring crypt.h, please file a bug"
+
+		# Only copy if it exists; some people may have tiny embedded
+		# systems without headers: https://bugs.gentoo.org/802207#c16
+		if [[ -f "${T}"/crypt.h ]] ; then
+			cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror "Error restoring crypt.h, please file a bug"
+		fi
+
 		elog "Please ignore a possible later error message about a file collision involving"
 		elog "/usr/include/crypt.h. We need to preserve this file for the moment to keep"
 		elog "the upgrade working, but it also needs to be overwritten when"

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 7be3669c52a..ce817f25421 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1519,7 +1519,12 @@ pkg_preinst() {
 	if ! use crypt && has_version "${CATEGORY}/${PN}[crypt]"; then
 		PRESERVED_OLD_LIBCRYPT=1
 		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
-		cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
+
+		# Only copy if it exists; some people may have tiny embedded
+		# systems without headers: https://bugs.gentoo.org/802207#c16
+		if [[ -f "${EROOT}"/usr/include/crypt.h ]] ; then
+			cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
+		fi
 	else
 		PRESERVED_OLD_LIBCRYPT=0
 	fi
@@ -1555,7 +1560,13 @@ pkg_postinst() {
 
 	if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
 		preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
-		cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror "Error restoring crypt.h, please file a bug"
+
+		# Only copy if it exists; some people may have tiny embedded
+		# systems without headers: https://bugs.gentoo.org/802207#c16
+		if [[ -f "${T}"/crypt.h ]] ; then
+			cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror "Error restoring crypt.h, please file a bug"
+		fi
+
 		elog "Please ignore a possible later error message about a file collision involving"
 		elog "/usr/include/crypt.h. We need to preserve this file for the moment to keep"
 		elog "the upgrade working, but it also needs to be overwritten when"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-11-03 17:27 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-11-03 17:27 UTC (permalink / raw
  To: gentoo-commits

commit:     609d72bc35743b798c849b1b6d33cbfcf40b3b15
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Nov  3 17:25:03 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov  3 17:26:51 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=609d72bc

sys-libs/glibc: drop crypt.h preservation workaround

Python was the main culprit and now that the erroneous/redundant
include of crypt.h (and separately, -lcrypt linkage) has been
dropped (and hence no longer affecting any consumers of Python.h
and libpython).

Hence, we can drop this as it was causing _more_ issues
than it prevented as folks were still using FEATURES="collision-protect"
instead of FEATURES="unmerge-orphans" (the news item and postinst
did mention this, though).

Bug: https://bugs.gentoo.org/802210
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r7.ebuild | 14 +-------------
 sys-libs/glibc/glibc-2.34.ebuild    | 15 +--------------
 sys-libs/glibc/glibc-9999.ebuild    | 14 +-------------
 3 files changed, 3 insertions(+), 40 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild b/sys-libs/glibc/glibc-2.33-r7.ebuild
index 146cce876a7..4fb9888470f 100644
--- a/sys-libs/glibc/glibc-2.33-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r7.ebuild
@@ -1506,12 +1506,6 @@ pkg_preinst() {
 	if ! use crypt && has_version "${CATEGORY}/${PN}[crypt]"; then
 		PRESERVED_OLD_LIBCRYPT=1
 		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
-
-		# Only copy if it exists; some people may have tiny embedded
-		# systems without headers: https://bugs.gentoo.org/802207#c16.
-		if [[ -f "${EROOT}"/usr/include/crypt.h ]] ; then
-			cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
-		fi
 	else
 		PRESERVED_OLD_LIBCRYPT=0
 	fi
@@ -1548,14 +1542,8 @@ pkg_postinst() {
 	if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
 		preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
 
-		# Only copy if it exists; some people may have tiny embedded
-		# systems without headers: https://bugs.gentoo.org/802207#c16
-		if [[ -f "${T}"/crypt.h ]] ; then
-			cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror "Error restoring crypt.h, please file a bug"
-		fi
-
 		elog "Please ignore a possible later error message about a file collision involving"
-		elog "/usr/include/crypt.h. We need to preserve this file for the moment to keep"
+		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."
 		elog "If you have FEATURES=collision-protect, please use FEATURES=unmerge-orphans instead!"

diff --git a/sys-libs/glibc/glibc-2.34.ebuild b/sys-libs/glibc/glibc-2.34.ebuild
index f292dc31fc3..e98c13cc390 100644
--- a/sys-libs/glibc/glibc-2.34.ebuild
+++ b/sys-libs/glibc/glibc-2.34.ebuild
@@ -1519,13 +1519,6 @@ pkg_preinst() {
 	if ! use crypt && has_version "${CATEGORY}/${PN}[crypt]"; then
 		PRESERVED_OLD_LIBCRYPT=1
 		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
-
-		# Only copy if it exists; some people may have tiny embedded
-		# systems without headers: https://bugs.gentoo.org/802207#c16
-		if [[ -f "${EROOT}"/usr/include/crypt.h ]] ; then
-			cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
-		fi
-
 	else
 		PRESERVED_OLD_LIBCRYPT=0
 	fi
@@ -1562,14 +1555,8 @@ pkg_postinst() {
 	if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
 		preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
 
-		# Only copy if it exists; some people may have tiny embedded
-		# systems without headers: https://bugs.gentoo.org/802207#c16
-		if [[ -f "${T}"/crypt.h ]] ; then
-			cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror "Error restoring crypt.h, please file a bug"
-		fi
-
 		elog "Please ignore a possible later error message about a file collision involving"
-		elog "/usr/include/crypt.h. We need to preserve this file for the moment to keep"
+		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

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ce817f25421..c1752e4d398 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1519,12 +1519,6 @@ pkg_preinst() {
 	if ! use crypt && has_version "${CATEGORY}/${PN}[crypt]"; then
 		PRESERVED_OLD_LIBCRYPT=1
 		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
-
-		# Only copy if it exists; some people may have tiny embedded
-		# systems without headers: https://bugs.gentoo.org/802207#c16
-		if [[ -f "${EROOT}"/usr/include/crypt.h ]] ; then
-			cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
-		fi
 	else
 		PRESERVED_OLD_LIBCRYPT=0
 	fi
@@ -1561,14 +1555,8 @@ pkg_postinst() {
 	if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
 		preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
 
-		# Only copy if it exists; some people may have tiny embedded
-		# systems without headers: https://bugs.gentoo.org/802207#c16
-		if [[ -f "${T}"/crypt.h ]] ; then
-			cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror "Error restoring crypt.h, please file a bug"
-		fi
-
 		elog "Please ignore a possible later error message about a file collision involving"
-		elog "/usr/include/crypt.h. We need to preserve this file for the moment to keep"
+		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


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-11-06  0:52 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-11-06  0:52 UTC (permalink / raw
  To: gentoo-commits

commit:     1e6a354272ad31c341c3764fc4f26c0abe76313c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  6 00:52:29 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov  6 00:52:29 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1e6a3542

sys-libs/glibc: Stabilize 2.33-r7 hppa, #809410

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild b/sys-libs/glibc/glibc-2.33-r7.ebuild
index 4fb9888470f..1f78af9e694 100644
--- a/sys-libs/glibc/glibc-2.33-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r7.ebuild
@@ -23,7 +23,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-11-06  2:35 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-11-06  2:35 UTC (permalink / raw
  To: gentoo-commits

commit:     f10efb4adc6e0266f0c0b1995c0ff01aa8e9cf28
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  5 17:34:01 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov  6 02:35:11 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f10efb4a

sys-libs/glibc: preserve libcrypt.so.1 as an orphan

This should help users who have FEATURES="-preserve-libs protect-owned".

Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
Bug: https://bugs.gentoo.org/809410
Closes: https://github.com/gentoo/gentoo/pull/22833
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r7.ebuild | 5 +++--
 sys-libs/glibc/glibc-2.34.ebuild    | 5 +++--
 sys-libs/glibc/glibc-9999.ebuild    | 5 +++--
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild b/sys-libs/glibc/glibc-2.33-r7.ebuild
index 1f78af9e694..cb9826d7be2 100644
--- a/sys-libs/glibc/glibc-2.33-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r7.ebuild
@@ -1503,9 +1503,9 @@ pkg_preinst() {
 	# 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]"; then
+	if ! use crypt && has_version "${CATEGORY}/${PN}[crypt]" && ! has preserve-libs ${FEATURES}; then
 		PRESERVED_OLD_LIBCRYPT=1
-		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
+		cp -p "${EROOT}/$(get_libdir)/libcrypt$(get_libname 1)" "${T}/libcrypt$(get_libname 1)" || die
 	else
 		PRESERVED_OLD_LIBCRYPT=0
 	fi
@@ -1540,6 +1540,7 @@ pkg_postinst() {
 	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"

diff --git a/sys-libs/glibc/glibc-2.34.ebuild b/sys-libs/glibc/glibc-2.34.ebuild
index e98c13cc390..a553af44216 100644
--- a/sys-libs/glibc/glibc-2.34.ebuild
+++ b/sys-libs/glibc/glibc-2.34.ebuild
@@ -1516,9 +1516,9 @@ pkg_preinst() {
 	# 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]"; then
+	if ! use crypt && has_version "${CATEGORY}/${PN}[crypt]" && ! has preserve-libs ${FEATURES}; then
 		PRESERVED_OLD_LIBCRYPT=1
-		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
+		cp -p "${EROOT}/$(get_libdir)/libcrypt$(get_libname 1)" "${T}/libcrypt$(get_libname 1)" || die
 	else
 		PRESERVED_OLD_LIBCRYPT=0
 	fi
@@ -1553,6 +1553,7 @@ pkg_postinst() {
 	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"

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index c1752e4d398..b08e07445f5 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1516,9 +1516,9 @@ pkg_preinst() {
 	# 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]"; then
+	if ! use crypt && has_version "${CATEGORY}/${PN}[crypt]" && ! has preserve-libs ${FEATURES}; then
 		PRESERVED_OLD_LIBCRYPT=1
-		preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
+		cp -p "${EROOT}/$(get_libdir)/libcrypt$(get_libname 1)" "${T}/libcrypt$(get_libname 1)" || die
 	else
 		PRESERVED_OLD_LIBCRYPT=0
 	fi
@@ -1553,6 +1553,7 @@ pkg_postinst() {
 	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"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-11-07 22:58 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-11-07 22:58 UTC (permalink / raw
  To: gentoo-commits

commit:     e1556304674e18a27aad9b69eb12b6c3f9231872
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  7 22:56:11 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Nov  7 22:58:03 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e1556304

sys-libs/glibc: Bump 2.34 to patchset 5

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-2.34.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 86427e09e86..283209c1f7b 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,7 +14,7 @@ DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6
 DIST glibc-2.33-patches-4.tar.xz 60124 BLAKE2B a7a99f39c16df241745772c31b10946dc44c51e6c09f8a447b905e7dd6ba529aee08f66a581431453c6665485ac1848861559aa3f0aaba8c2061c1f1eb77d9be SHA512 05c33dc465a98097f836783bb5037dfa14b3a2c0c140014f642ea72954222ae919fe2db9573ee70ca9c1881b3b59dd4b815a8f39f331494fa12951c9012797ef
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
-DIST glibc-2.34-patches-4.tar.xz 49256 BLAKE2B fa25745eab668932cec66cd77e1fe98f7f80af00841626741087c210fbe59523a8d76b9b40214e7a67b1a53267a990a0c90de7dd7da8590c6517aa0fb58c51bb SHA512 8afef6fc24e5eb32b063c7811e8aadb8f4c6548500e8c1a90787b1810deed1e176468477730f6ce6ae4523decf0acce7a36711cdd001666fa6b7d8d83af6347b
+DIST glibc-2.34-patches-5.tar.xz 56832 BLAKE2B e5f5e8e41551d9f90355e9fc854e541cdcd5dd172e12dafa84256b7aeb999c0980ec6e7299701b78b0257980f5cf91019edfdf9796bec6b886434aa1960b2d6c SHA512 bc56fe2870629700d931150e1ebdc6e9b3318e8dabf5491d3645efd4db11032e21562e9276d97fc052c45362bfbca7f3d80d93277c2bf8aa3e05a5001df75c60
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.34.ebuild b/sys-libs/glibc/glibc-2.34.ebuild
index a553af44216..461ad27a5e2 100644
--- a/sys-libs/glibc/glibc-2.34.ebuild
+++ b/sys-libs/glibc/glibc-2.34.ebuild
@@ -20,7 +20,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=4
+PATCH_VER=5
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-11-07 22:58 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-11-07 22:58 UTC (permalink / raw
  To: gentoo-commits

commit:     4a03efd2130435b7fdca781863a40beec4047b94
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  7 22:57:11 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Nov  7 22:58:06 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4a03efd2

sys-libs/glibc: 2.34 revbump to force rebuilds with current patchset

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/{glibc-2.34.ebuild => glibc-2.34-r1.ebuild} | 0
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.34.ebuild b/sys-libs/glibc/glibc-2.34-r1.ebuild
similarity index 100%
rename from sys-libs/glibc/glibc-2.34.ebuild
rename to sys-libs/glibc/glibc-2.34-r1.ebuild


^ permalink raw reply	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-11-11 21:04 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-11-11 21:04 UTC (permalink / raw
  To: gentoo-commits

commit:     3d081cb997d18d200c71e1ff394e17db2f01f38d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 11 21:02:52 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov 11 21:02:52 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d081cb9

sys-libs/glibc: drop Python 3.10 from PYTHON_COMPAT to avoid circular deps

Needed for now to try help upgrades and avoid circular dependencies
with glibc -> python -> libcrypt -> libxcrypt -> glibc -> ...

Bug: https://bugs.gentoo.org/699422
Bug: https://bugs.gentoo.org/702806
Bug: https://bugs.gentoo.org/809410
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r7.ebuild | 5 ++++-
 sys-libs/glibc/glibc-2.34-r1.ebuild | 5 ++++-
 sys-libs/glibc/glibc-9999.ebuild    | 5 ++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild b/sys-libs/glibc/glibc-2.33-r7.ebuild
index cb9826d7be2..20390ea8ba2 100644
--- a/sys-libs/glibc/glibc-2.33-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r7.ebuild
@@ -3,7 +3,10 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{7,8,9,10} )
+# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
+# on upgrades as people migrate to libxcrypt.
+# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
+PYTHON_COMPAT=( python3_{7,8,9} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \

diff --git a/sys-libs/glibc/glibc-2.34-r1.ebuild b/sys-libs/glibc/glibc-2.34-r1.ebuild
index 461ad27a5e2..f5d98be9cf6 100644
--- a/sys-libs/glibc/glibc-2.34-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r1.ebuild
@@ -6,7 +6,10 @@ EAPI=7
 # Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
 # Please read & adapt the page as necessary if obsolete.
 
-PYTHON_COMPAT=( python3_{7,8,9,10} )
+# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
+# on upgrades as people migrate to libxcrypt.
+# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
+PYTHON_COMPAT=( python3_{7,8,9} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index b08e07445f5..ce5ad8d3c43 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -6,7 +6,10 @@ EAPI=7
 # Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
 # Please read & adapt the page as necessary if obsolete.
 
-PYTHON_COMPAT=( python3_{7,8,9,10} )
+# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
+# on upgrades as people migrate to libxcrypt.
+# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
+PYTHON_COMPAT=( python3_{7,8,9} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-11-13 21:35 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-11-13 21:35 UTC (permalink / raw
  To: gentoo-commits

commit:     3345045c9ffffcdaae0f55d29a6aeccccc7dfd74
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 13 21:34:09 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Nov 13 21:35:10 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3345045c

sys-libs/glibc: re-keyword 2.34-r1

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
Bug: https://bugs.gentoo.org/803482

 sys-libs/glibc/glibc-2.34-r1.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.34-r1.ebuild b/sys-libs/glibc/glibc-2.34-r1.ebuild
index f5d98be9cf6..790afee5b33 100644
--- a/sys-libs/glibc/glibc-2.34-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r1.ebuild
@@ -29,8 +29,7 @@ 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=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-11-14 23:05 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-11-14 23:05 UTC (permalink / raw
  To: gentoo-commits

commit:     e1c394c177c08679b430b78c3dbf7611768ca983
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 14 23:05:33 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Nov 14 23:05:33 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e1c394c1

sys-libs/glibc: restart systemd in pkg_postinst

Closes: https://bugs.gentoo.org/823756
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/{glibc-2.34-r1.ebuild => glibc-2.34-r2.ebuild} | 6 ++++++
 sys-libs/glibc/glibc-9999.ebuild                              | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.34-r1.ebuild b/sys-libs/glibc/glibc-2.34-r2.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.34-r1.ebuild
rename to sys-libs/glibc/glibc-2.34-r2.ebuild
index 790afee5b335..851820e3c05e 100644
--- a/sys-libs/glibc/glibc-2.34-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r2.ebuild
@@ -1539,6 +1539,12 @@ pkg_postinst() {
 		use compile-locales || run_locale_gen "${EROOT}/"
 	fi
 
+	if systemd_is_booted && [[ -z ${ROOT} ]] ; then
+		# We need to restart systemd when upgrading from < 2.34
+		# bug #823756
+		systemctl daemon-reexec
+	fi
+
 	# Check for sanity of /etc/nsswitch.conf, take 2
 	if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then
 		local entry

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ce5ad8d3c43d..d62fe8108de1 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1540,6 +1540,12 @@ pkg_postinst() {
 		use compile-locales || run_locale_gen "${EROOT}/"
 	fi
 
+	if systemd_is_booted && [[ -z ${ROOT} ]] ; then
+		# We need to restart systemd when upgrading from < 2.34
+		# bug #823756
+		systemctl daemon-reexec
+	fi
+
 	# Check for sanity of /etc/nsswitch.conf, take 2
 	if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then
 		local entry


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-11-15 16:13 Mike Gilbert
  0 siblings, 0 replies; 1076+ messages in thread
From: Mike Gilbert @ 2021-11-15 16:13 UTC (permalink / raw
  To: gentoo-commits

commit:     bd8116a913946503c2647d5ea36f7318a37b9cd6
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 15 16:12:58 2021 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Mon Nov 15 16:12:58 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bd8116a9

sys-libs/glibc: avoid duplicate slashes in locale-gen call

Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r2.ebuild | 4 ++--
 sys-libs/glibc/glibc-9999.ebuild    | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.34-r2.ebuild b/sys-libs/glibc/glibc-2.34-r2.ebuild
index 851820e3c05e..4510d31aeb66 100644
--- a/sys-libs/glibc/glibc-2.34-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r2.ebuild
@@ -1196,13 +1196,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}" \

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index d62fe8108de1..72cca561f703 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1197,13 +1197,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}" \


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-11-16 23:33 Jason A. Donenfeld
  0 siblings, 0 replies; 1076+ messages in thread
From: Jason A. Donenfeld @ 2021-11-16 23:33 UTC (permalink / raw
  To: gentoo-commits

commit:     876602ee223c6c4225371b428a346f0b2d7f2020
Author:     Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 16 23:30:13 2021 +0000
Commit:     Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
CommitDate: Tue Nov 16 23:33:44 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=876602ee

sys-libs/glibc: add -mno-avx512f to -m32 build for gcc 11 bug

No need to revbump as this only affects folks who cannot currently
compile.

Closes: https://bugs.gentoo.org/823780
Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Jason A. Donenfeld <zx2c4 <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r2.ebuild | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.34-r2.ebuild b/sys-libs/glibc/glibc-2.34-r2.ebuild
index 4510d31aeb66..00c85cf62a55 100644
--- a/sys-libs/glibc/glibc-2.34-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r2.ebuild
@@ -326,6 +326,14 @@ setup_target_flags() {
 				export CFLAGS_x86="${CFLAGS_x86} -march=${t}"
 				einfo "Auto adding -march=${t} to CFLAGS_x86 #185404 (ABI=${ABI})"
 			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) < 3)); then
+				export CFLAGS_x86="${CFLAGS_x86} -mno-avx512f"
+				einfo "Auto adding -mno-avx512f to CFLAGS_x86 #823780 (ABI=${ABI})"
+			fi
 		;;
 		mips)
 			# The mips abi cannot support the GNU style hashes. #233233


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-11-26 18:52 Mike Frysinger
  0 siblings, 0 replies; 1076+ messages in thread
From: Mike Frysinger @ 2021-11-26 18:52 UTC (permalink / raw
  To: gentoo-commits

commit:     f4ad4f8f0fa05e7504efb3ef6ef46a650b47a4d6
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 26 18:46:41 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Nov 26 18:46:41 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f4ad4f8f

sys-libs/glibc: remove deps on implicit system packages

These packages are guaranteed to exist as part of implicit system,
so there's no need to list them here, and we want to keep the C lib
deps minimal to avoid circular deps.

Closes: https://bugs.gentoo.org/740750
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r8.ebuild | 15 ---------------
 sys-libs/glibc/glibc-2.33-r1.ebuild | 15 ---------------
 sys-libs/glibc/glibc-2.33-r7.ebuild | 15 ---------------
 sys-libs/glibc/glibc-2.34-r2.ebuild | 15 ---------------
 sys-libs/glibc/glibc-9999.ebuild    | 15 ---------------
 5 files changed, 75 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index 101254fce5ab..f91909bea8da 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -91,18 +91,11 @@ fi
 # Lastly, let's avoid some openssh nastiness, bug 708224, as
 # convenience to our users.
 
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
 BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
 	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
 "
 COMMON_DEPEND="
 	gd? ( media-libs/gd:2= )
@@ -116,17 +109,9 @@ COMMON_DEPEND="
 	!<net-misc/openssh-8.1_p1-r2
 "
 DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
 	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
 	sys-apps/gentoo-functions
 "
 

diff --git a/sys-libs/glibc/glibc-2.33-r1.ebuild b/sys-libs/glibc/glibc-2.33-r1.ebuild
index cdbca06cc5d5..fdd2b96d886e 100644
--- a/sys-libs/glibc/glibc-2.33-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r1.ebuild
@@ -90,18 +90,11 @@ fi
 # Lastly, let's avoid some openssh nastiness, bug 708224, as
 # convenience to our users.
 
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
 BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-1.3.1
 	sys-devel/bison
 	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
 "
 COMMON_DEPEND="
 	gd? ( media-libs/gd:2= )
@@ -114,17 +107,9 @@ COMMON_DEPEND="
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
 	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
 	sys-apps/gentoo-functions
 	!<app-misc/pax-utils-1.3.1
 	!<net-misc/openssh-8.1_p1-r2

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild b/sys-libs/glibc/glibc-2.33-r7.ebuild
index 20390ea8ba2a..1d944e2affa0 100644
--- a/sys-libs/glibc/glibc-2.33-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r7.ebuild
@@ -96,18 +96,11 @@ fi
 # Lastly, let's avoid some openssh nastiness, bug 708224, as
 # convenience to our users.
 
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
 BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-1.3.1
 	sys-devel/bison
 	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
 "
 COMMON_DEPEND="
 	gd? ( media-libs/gd:2= )
@@ -120,17 +113,9 @@ COMMON_DEPEND="
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
 	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
 	sys-apps/gentoo-functions
 	!<app-misc/pax-utils-1.3.1
 	!<net-misc/openssh-8.1_p1-r2

diff --git a/sys-libs/glibc/glibc-2.34-r2.ebuild b/sys-libs/glibc/glibc-2.34-r2.ebuild
index 00c85cf62a55..365382d35fae 100644
--- a/sys-libs/glibc/glibc-2.34-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r2.ebuild
@@ -102,18 +102,11 @@ fi
 # Lastly, let's avoid some openssh nastiness, bug 708224, as
 # convenience to our users.
 
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
 BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
 	sys-devel/bison
 	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
 "
 COMMON_DEPEND="
 	gd? ( media-libs/gd:2= )
@@ -126,17 +119,9 @@ COMMON_DEPEND="
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
 	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
 	sys-apps/gentoo-functions
 	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
 	!<net-misc/openssh-8.1_p1-r2

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 72cca561f703..dd80e39f1e04 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -103,18 +103,11 @@ fi
 # Lastly, let's avoid some openssh nastiness, bug 708224, as
 # convenience to our users.
 
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
 BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
 	sys-devel/bison
 	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
 "
 COMMON_DEPEND="
 	gd? ( media-libs/gd:2= )
@@ -127,17 +120,9 @@ COMMON_DEPEND="
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
 	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
 	sys-apps/gentoo-functions
 	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
 	!<net-misc/openssh-8.1_p1-r2


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-11-26 19:42 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-11-26 19:42 UTC (permalink / raw
  To: gentoo-commits

commit:     c0631c02e908780c195d5f52e02e36281a81b7d9
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 26 19:41:24 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Nov 26 19:42:04 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c0631c02

Revert "sys-libs/glibc: remove deps on implicit system packages"

This reverts commit f4ad4f8f0fa05e7504efb3ef6ef46a650b47a4d6.

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.32-r8.ebuild | 15 +++++++++++++++
 sys-libs/glibc/glibc-2.33-r1.ebuild | 15 +++++++++++++++
 sys-libs/glibc/glibc-2.33-r7.ebuild | 15 +++++++++++++++
 sys-libs/glibc/glibc-2.34-r2.ebuild | 15 +++++++++++++++
 sys-libs/glibc/glibc-9999.ebuild    | 15 +++++++++++++++
 5 files changed, 75 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index f91909bea8da..101254fce5ab 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -91,11 +91,18 @@ fi
 # Lastly, let's avoid some openssh nastiness, bug 708224, as
 # convenience to our users.
 
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
 BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-0.1.10
 	sys-devel/bison
 	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
 "
 COMMON_DEPEND="
 	gd? ( media-libs/gd:2= )
@@ -109,9 +116,17 @@ COMMON_DEPEND="
 	!<net-misc/openssh-8.1_p1-r2
 "
 DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
 	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
 	sys-apps/gentoo-functions
 "
 

diff --git a/sys-libs/glibc/glibc-2.33-r1.ebuild b/sys-libs/glibc/glibc-2.33-r1.ebuild
index fdd2b96d886e..cdbca06cc5d5 100644
--- a/sys-libs/glibc/glibc-2.33-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r1.ebuild
@@ -90,11 +90,18 @@ fi
 # Lastly, let's avoid some openssh nastiness, bug 708224, as
 # convenience to our users.
 
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
 BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-1.3.1
 	sys-devel/bison
 	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
 "
 COMMON_DEPEND="
 	gd? ( media-libs/gd:2= )
@@ -107,9 +114,17 @@ COMMON_DEPEND="
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
 	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
 	sys-apps/gentoo-functions
 	!<app-misc/pax-utils-1.3.1
 	!<net-misc/openssh-8.1_p1-r2

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild b/sys-libs/glibc/glibc-2.33-r7.ebuild
index 1d944e2affa0..20390ea8ba2a 100644
--- a/sys-libs/glibc/glibc-2.33-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r7.ebuild
@@ -96,11 +96,18 @@ fi
 # Lastly, let's avoid some openssh nastiness, bug 708224, as
 # convenience to our users.
 
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
 BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-1.3.1
 	sys-devel/bison
 	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
 "
 COMMON_DEPEND="
 	gd? ( media-libs/gd:2= )
@@ -113,9 +120,17 @@ COMMON_DEPEND="
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
 	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
 	sys-apps/gentoo-functions
 	!<app-misc/pax-utils-1.3.1
 	!<net-misc/openssh-8.1_p1-r2

diff --git a/sys-libs/glibc/glibc-2.34-r2.ebuild b/sys-libs/glibc/glibc-2.34-r2.ebuild
index 365382d35fae..00c85cf62a55 100644
--- a/sys-libs/glibc/glibc-2.34-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r2.ebuild
@@ -102,11 +102,18 @@ fi
 # Lastly, let's avoid some openssh nastiness, bug 708224, as
 # convenience to our users.
 
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
 BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
 	sys-devel/bison
 	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
 "
 COMMON_DEPEND="
 	gd? ( media-libs/gd:2= )
@@ -119,9 +126,17 @@ COMMON_DEPEND="
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
 	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
 	sys-apps/gentoo-functions
 	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
 	!<net-misc/openssh-8.1_p1-r2

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index dd80e39f1e04..72cca561f703 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -103,11 +103,18 @@ fi
 # Lastly, let's avoid some openssh nastiness, bug 708224, as
 # convenience to our users.
 
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
 BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
 	sys-devel/bison
 	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
 "
 COMMON_DEPEND="
 	gd? ( media-libs/gd:2= )
@@ -120,9 +127,17 @@ COMMON_DEPEND="
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
 	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
 	sys-apps/gentoo-functions
 	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
 	!<net-misc/openssh-8.1_p1-r2


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-11-27 23:47 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-11-27 23:47 UTC (permalink / raw
  To: gentoo-commits

commit:     89a6a8647d74612648f0502baa27660008cc256c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 27 23:47:10 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 27 23:47:27 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=89a6a864

sys-libs/glibc: don't apply GCC 11 AVX512 workaround to upcoming patch release

Bug: https://bugs.gentoo.org/823780
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r2.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.34-r2.ebuild b/sys-libs/glibc/glibc-2.34-r2.ebuild
index 00c85cf62a55..04479ab604b7 100644
--- a/sys-libs/glibc/glibc-2.34-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r2.ebuild
@@ -330,9 +330,9 @@ setup_target_flags() {
 			# 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) < 3)); then
+			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 #823780 (ABI=${ABI})"
+				einfo "Auto adding -mno-avx512f to CFLAGS_x86 (bug #823780) (ABI=${ABI})"
 			fi
 		;;
 		mips)


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-11-29 10:13 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-11-29 10:13 UTC (permalink / raw
  To: gentoo-commits

commit:     4241f37f9437f5e5e9c61ad8411e4515d96728a5
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 29 10:11:48 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Nov 29 10:13:18 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4241f37f

sys-libs/glibc: 2.34 revision/patchlevel bump

Closes: https://bugs.gentoo.org/807832
Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.34-r3.ebuild | 1580 +++++++++++++++++++++++++++++++++++
 2 files changed, 1581 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 283209c1f7be..c54232241af5 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,6 +15,7 @@ DIST glibc-2.33-patches-4.tar.xz 60124 BLAKE2B a7a99f39c16df241745772c31b10946dc
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-5.tar.xz 56832 BLAKE2B e5f5e8e41551d9f90355e9fc854e541cdcd5dd172e12dafa84256b7aeb999c0980ec6e7299701b78b0257980f5cf91019edfdf9796bec6b886434aa1960b2d6c SHA512 bc56fe2870629700d931150e1ebdc6e9b3318e8dabf5491d3645efd4db11032e21562e9276d97fc052c45362bfbca7f3d80d93277c2bf8aa3e05a5001df75c60
+DIST glibc-2.34-patches-6.tar.xz 58396 BLAKE2B c25696e2aceef9ea4724716acde377d91b8a76b2edca2b293fcd6c89f635f63a612f8c1ecd861367b1394ebacc4b0151b0c6b68c2b08a7bde3a54a76400f35c5 SHA512 343922492e448d978dbcad1718804f892d002b6d4ce366da4cf571d97145ed850fb4b2862645681f487a9a18a77ea48f23010c0c61ea7cf914d26fd149b8271d
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.34-r3.ebuild b/sys-libs/glibc/glibc-2.34-r3.ebuild
new file mode 100644
index 000000000000..c06bdbcbb4b8
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.34-r3.ebuild
@@ -0,0 +1,1580 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
+# on upgrades as people migrate to libxcrypt.
+# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
+PYTHON_COMPAT=( python3_{7,8,9} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=6
+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"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			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)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+	local VAR=CFLAGS_${ABI}
+	# 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}"
+}
+
+foreach_abi() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; 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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+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
+		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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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 . -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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
+	fi
+
+	if systemd_is_booted && [[ -z ${ROOT} ]] ; then
+		# We need to restart systemd when upgrading from < 2.34
+		# bug #823756
+		systemctl daemon-reexec
+	fi
+
+	# 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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-12-01 14:53 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-12-01 14:53 UTC (permalink / raw
  To: gentoo-commits

commit:     30fe8b89aef9f0701f6dcd935421b8ed5da614cc
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 23 18:37:56 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec  1 14:52:45 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=30fe8b89

sys-libs/glibc: replace systemd reexec with a warning

Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/22960
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r2.ebuild | 21 ++++++++++++++++-----
 sys-libs/glibc/glibc-9999.ebuild    | 21 ++++++++++++++++-----
 2 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.34-r2.ebuild b/sys-libs/glibc/glibc-2.34-r2.ebuild
index 04479ab604b7..dd50e8578a35 100644
--- a/sys-libs/glibc/glibc-2.34-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r2.ebuild
@@ -730,6 +730,20 @@ 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."
+				break
+			fi
+		done
+	fi
+}
+
 #
 # the phases
 #
@@ -740,6 +754,7 @@ pkg_pretend() {
 	# All the checks...
 	einfo "Checking general environment sanity."
 	sanity_prechecks
+	upgrade_warning
 }
 
 pkg_setup() {
@@ -1547,11 +1562,7 @@ pkg_postinst() {
 		use compile-locales || run_locale_gen "${EROOT}/"
 	fi
 
-	if systemd_is_booted && [[ -z ${ROOT} ]] ; then
-		# We need to restart systemd when upgrading from < 2.34
-		# bug #823756
-		systemctl daemon-reexec
-	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

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 72cca561f703..79318fb53543 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -723,6 +723,20 @@ 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."
+				break
+			fi
+		done
+	fi
+}
+
 #
 # the phases
 #
@@ -733,6 +747,7 @@ pkg_pretend() {
 	# All the checks...
 	einfo "Checking general environment sanity."
 	sanity_prechecks
+	upgrade_warning
 }
 
 pkg_setup() {
@@ -1540,11 +1555,7 @@ pkg_postinst() {
 		use compile-locales || run_locale_gen "${EROOT}/"
 	fi
 
-	if systemd_is_booted && [[ -z ${ROOT} ]] ; then
-		# We need to restart systemd when upgrading from < 2.34
-		# bug #823756
-		systemctl daemon-reexec
-	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


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-12-05 10:26 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-12-05 10:26 UTC (permalink / raw
  To: gentoo-commits

commit:     28de41f0523327e9f7334595017b5cdc37d0513b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Dec  2 15:49:01 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Dec  5 10:24:54 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=28de41f0

sys-libs/glibc: Update live ebuild

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 79318fb53543..f5422fcf72cb 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -47,7 +47,7 @@ SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${L
 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 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
 MIN_KERN_VER="3.2.0"
@@ -723,20 +723,6 @@ 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."
-				break
-			fi
-		done
-	fi
-}
-
 #
 # the phases
 #
@@ -747,7 +733,6 @@ pkg_pretend() {
 	# All the checks...
 	einfo "Checking general environment sanity."
 	sanity_prechecks
-	upgrade_warning
 }
 
 pkg_setup() {
@@ -799,6 +784,14 @@ src_prepare() {
 		einfo "Done."
 	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
 
 	gnuconfig_update
@@ -1555,7 +1548,11 @@ pkg_postinst() {
 		use compile-locales || run_locale_gen "${EROOT}/"
 	fi
 
-	upgrade_warning
+	if systemd_is_booted && [[ -z ${ROOT} ]] ; then
+		# We need to restart systemd when upgrading from < 2.34
+		# bug #823756
+		systemctl daemon-reexec
+	fi
 
 	# Check for sanity of /etc/nsswitch.conf, take 2
 	if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-12-05 15:32 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-12-05 15:32 UTC (permalink / raw
  To: gentoo-commits

commit:     838f2e1228f33a1ef2fabae97cd18d8117b4a72d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Dec  5 15:31:30 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Dec  5 15:32:00 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=838f2e12

sys-libs/glibc: Add experimental clang-kicking

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f5422fcf72cb..39b77e312fa5 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -819,7 +819,32 @@ glibc_do_configure() {
 	# we accumulate crap across abis
 	unset CXX
 
-	einfo "Configuring glibc for nptl"
+	# 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.
+	if tc-is-clang && ! use custom-cflags ; then
+		local current_binutils_path=$(binutils-config -B)
+		local current_gcc_path=$(gcc-config -B)
+		einfo "Overriding clang configuration, since it won't work here"
+
+		export CC="${current_gcc_path}/gcc"
+		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?
+	fi
 
 	if use doc ; then
 		export MAKEINFO=makeinfo


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-12-05 20:32 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-12-05 20:32 UTC (permalink / raw
  To: gentoo-commits

commit:     320e0789812c511e8ab31fc6bec9b3162a6416ae
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Dec  5 20:31:55 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Dec  5 20:31:55 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=320e0789

sys-libs/glibc: some rework of 9999 ebuild, needs testing (e.g. crossdev)

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 175 +++++++++++++++++++++------------------
 1 file changed, 96 insertions(+), 79 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 39b77e312fa5..ea87ec9994c8 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -401,6 +401,7 @@ setup_flags() {
 		filter-flags '-O?'
 		append-flags -O2
 	fi
+
 	strip-unsupported-flags
 	filter-flags -m32 -m64 '-mabi=*'
 
@@ -515,14 +516,103 @@ 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 to the value at start of emerge
+	export CC=${__ORIG_CC:-${CC}}
+
+	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.
+
+		local current_binutils_path=$(binutils-config -B)
+		local current_gcc_path=$(gcc-config -B)
+		einfo "Overriding clang configuration, since it won't work here"
+
+		export __ORIG_CC=${CC}
+
+		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 __ORIG_CC=${CC}
+
+		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} ${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}"
+
+	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() {
@@ -812,86 +902,13 @@ 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
-
-	# 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.
-	if tc-is-clang && ! use custom-cflags ; then
-		local current_binutils_path=$(binutils-config -B)
-		local current_gcc_path=$(gcc-config -B)
-		einfo "Overriding clang configuration, since it won't work here"
-
-		export CC="${current_gcc_path}/gcc"
-		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?
-	fi
-
-	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


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-12-09  6:37 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-12-09  6:37 UTC (permalink / raw
  To: gentoo-commits

commit:     1aa54cb91cfc6da9f151abaa49f045ea291189f4
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Dec  9 05:57:30 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Dec  9 05:57:30 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1aa54cb9

sys-libs/glibc: re-sync 2.34-r3/9999 for warning-on-upgrade

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r3.ebuild | 21 ++++++++++++++++-----
 sys-libs/glibc/glibc-9999.ebuild    | 21 ++++++++++++++++-----
 2 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.34-r3.ebuild b/sys-libs/glibc/glibc-2.34-r3.ebuild
index 7053b85282f1..b65194c38f6f 100644
--- a/sys-libs/glibc/glibc-2.34-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r3.ebuild
@@ -730,6 +730,20 @@ 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."
+				break
+			fi
+		done
+	fi
+}
+
 #
 # the phases
 #
@@ -740,6 +754,7 @@ pkg_pretend() {
 	# All the checks...
 	einfo "Checking general environment sanity."
 	sanity_prechecks
+	upgrade_warning
 }
 
 pkg_setup() {
@@ -1558,11 +1573,7 @@ pkg_postinst() {
 		use compile-locales || run_locale_gen "${EROOT}/"
 	fi
 
-	if systemd_is_booted && [[ -z ${ROOT} ]] ; then
-		# We need to restart systemd when upgrading from < 2.34
-		# bug #823756
-		systemctl daemon-reexec
-	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

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ea87ec9994c8..22f47562ff94 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -813,6 +813,20 @@ 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."
+				break
+			fi
+		done
+	fi
+}
+
 #
 # the phases
 #
@@ -823,6 +837,7 @@ pkg_pretend() {
 	# All the checks...
 	einfo "Checking general environment sanity."
 	sanity_prechecks
+	upgrade_warning
 }
 
 pkg_setup() {
@@ -1590,11 +1605,7 @@ pkg_postinst() {
 		use compile-locales || run_locale_gen "${EROOT}/"
 	fi
 
-	if systemd_is_booted && [[ -z ${ROOT} ]] ; then
-		# We need to restart systemd when upgrading from < 2.34
-		# bug #823756
-		systemctl daemon-reexec
-	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


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-12-09 20:55 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-12-09 20:55 UTC (permalink / raw
  To: gentoo-commits

commit:     c9ab1c9214a660b15d843450c661665572530e23
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Dec  9 20:04:23 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Dec  9 20:55:25 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c9ab1c92

sys-libs/glibc: 2.34 revbump, rewritten env code in ebuild

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest                            |  1 +
 .../{glibc-9999.ebuild => glibc-2.34-r4.ebuild}    | 27 ++++++++++++++--------
 sys-libs/glibc/glibc-9999.ebuild                   | 17 +++++++-------
 3 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index c54232241af5..0dd6d9f18599 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,6 +16,7 @@ DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf00
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-5.tar.xz 56832 BLAKE2B e5f5e8e41551d9f90355e9fc854e541cdcd5dd172e12dafa84256b7aeb999c0980ec6e7299701b78b0257980f5cf91019edfdf9796bec6b886434aa1960b2d6c SHA512 bc56fe2870629700d931150e1ebdc6e9b3318e8dabf5491d3645efd4db11032e21562e9276d97fc052c45362bfbca7f3d80d93277c2bf8aa3e05a5001df75c60
 DIST glibc-2.34-patches-6.tar.xz 58396 BLAKE2B c25696e2aceef9ea4724716acde377d91b8a76b2edca2b293fcd6c89f635f63a612f8c1ecd861367b1394ebacc4b0151b0c6b68c2b08a7bde3a54a76400f35c5 SHA512 343922492e448d978dbcad1718804f892d002b6d4ce366da4cf571d97145ed850fb4b2862645681f487a9a18a77ea48f23010c0c61ea7cf914d26fd149b8271d
+DIST glibc-2.34-patches-8.tar.xz 61284 BLAKE2B a042d3bfd85cb9732f033eb1489fc4a9d5b42ec599bb320a97a9633047819d1d02b2f00dce601ddb02036f8bf0d67f9b0d6463785965db72d9ac2ce13765fa07 SHA512 1d92abb82ae404b90841217bba3b1ccb7e03799e5f21656b0a2eaaf06bd4a5a2f0fd7ebf927acc72fce0e2af6bb1a2e8658bac431423d07e75dce1f2868bd029
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.34-r4.ebuild
similarity index 98%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.34-r4.ebuild
index 22f47562ff94..062f592828cb 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r4.ebuild
@@ -23,7 +23,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=2
+PATCH_VER=8
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then
@@ -327,6 +327,14 @@ setup_target_flags() {
 				export CFLAGS_x86="${CFLAGS_x86} -march=${t}"
 				einfo "Auto adding -march=${t} to CFLAGS_x86 #185404 (ABI=${ABI})"
 			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)
 			# The mips abi cannot support the GNU style hashes. #233233
@@ -526,8 +534,13 @@ setup_env() {
 		export MAKEINFO=/dev/null
 	fi
 
-	# Reset CC to the value at start of emerge
-	export CC=${__ORIG_CC:-${CC}}
+	# 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
 
@@ -544,8 +557,6 @@ setup_env() {
 		local current_gcc_path=$(gcc-config -B)
 		einfo "Overriding clang configuration, since it won't work here"
 
-		export __ORIG_CC=${CC}
-
 		export CC="${current_gcc_path}/gcc"
 		export CXX="${current_gcc_path}/g++"
 		export LD="${current_binutils_path}/ld.bfd"
@@ -568,8 +579,6 @@ setup_env() {
 
 		# this is the "normal" case
 
-		export __ORIG_CC=${CC}
-
 		export CC="$(tc-getCC ${CTARGET})"
 		export CXX="$(tc-getCXX ${CTARGET})"
 
@@ -598,10 +607,10 @@ setup_env() {
 	# 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} ${LDFLAGS}"
+	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}"
+	export CXX="${__GLIBC_CXX} ${__abi_CFLAGS} ${CFLAGS}"
 
 	if is_crosscompile; then
 		# Assume worst-case bootstrap: glibc is buil first time

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 22f47562ff94..250af42f3f0a 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -526,8 +526,13 @@ setup_env() {
 		export MAKEINFO=/dev/null
 	fi
 
-	# Reset CC to the value at start of emerge
-	export CC=${__ORIG_CC:-${CC}}
+	# 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
 
@@ -544,8 +549,6 @@ setup_env() {
 		local current_gcc_path=$(gcc-config -B)
 		einfo "Overriding clang configuration, since it won't work here"
 
-		export __ORIG_CC=${CC}
-
 		export CC="${current_gcc_path}/gcc"
 		export CXX="${current_gcc_path}/g++"
 		export LD="${current_binutils_path}/ld.bfd"
@@ -568,8 +571,6 @@ setup_env() {
 
 		# this is the "normal" case
 
-		export __ORIG_CC=${CC}
-
 		export CC="$(tc-getCC ${CTARGET})"
 		export CXX="$(tc-getCXX ${CTARGET})"
 
@@ -598,10 +599,10 @@ setup_env() {
 	# 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} ${LDFLAGS}"
+	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}"
+	export CXX="${__GLIBC_CXX} ${__abi_CFLAGS} ${CFLAGS}"
 
 	if is_crosscompile; then
 		# Assume worst-case bootstrap: glibc is buil first time


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-12-18 21:51 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-12-18 21:51 UTC (permalink / raw
  To: gentoo-commits

commit:     a11dd6729862d5ded07a7956fb6c553cd415c542
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 18 21:50:18 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Dec 18 21:50:54 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a11dd672

sys-libs/glibc: Filter LFS and TIME64 defines

Closes: https://bugs.gentoo.org/829583
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r4.ebuild | 4 ++++
 sys-libs/glibc/glibc-9999.ebuild    | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.34-r4.ebuild b/sys-libs/glibc/glibc-2.34-r4.ebuild
index 062f592828cb..ee3c1a744ba7 100644
--- a/sys-libs/glibc/glibc-2.34-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r4.ebuild
@@ -423,6 +423,10 @@ setup_flags() {
 	# #492892
 	filter-flags -frecord-gcc-switches
 
+	# #829583
+	filter-lfs-flags
+	filter-flags -D_TIME_BITS=64
+
 	unset CBUILD_OPT CTARGET_OPT
 	if use multilib ; then
 		CTARGET_OPT=$(get_abi_CTARGET)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 250af42f3f0a..a9caa901cd6f 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -415,6 +415,10 @@ setup_flags() {
 	# #492892
 	filter-flags -frecord-gcc-switches
 
+	# #829583
+	filter-lfs-flags
+	filter-flags -D_TIME_BITS=64
+
 	unset CBUILD_OPT CTARGET_OPT
 	if use multilib ; then
 		CTARGET_OPT=$(get_abi_CTARGET)


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-12-18 21:58 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2021-12-18 21:58 UTC (permalink / raw
  To: gentoo-commits

commit:     062a9fcfe09a224f74aed0d86598a4da9bfefc95
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 18 21:58:02 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Dec 18 21:58:02 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=062a9fcf

sys-libs/glibc: filter-lfs-flags now does TIME_BITS too

toolchain-funcs.eclass patch was just pushed.

Bug: https://bugs.gentoo.org/829583
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r4.ebuild | 1 -
 sys-libs/glibc/glibc-9999.ebuild    | 1 -
 2 files changed, 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.34-r4.ebuild b/sys-libs/glibc/glibc-2.34-r4.ebuild
index ee3c1a744ba7..2a827a3494aa 100644
--- a/sys-libs/glibc/glibc-2.34-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r4.ebuild
@@ -425,7 +425,6 @@ setup_flags() {
 
 	# #829583
 	filter-lfs-flags
-	filter-flags -D_TIME_BITS=64
 
 	unset CBUILD_OPT CTARGET_OPT
 	if use multilib ; then

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a9caa901cd6f..2cb4bf86808c 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -417,7 +417,6 @@ setup_flags() {
 
 	# #829583
 	filter-lfs-flags
-	filter-flags -D_TIME_BITS=64
 
 	unset CBUILD_OPT CTARGET_OPT
 	if use multilib ; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-12-19 11:40 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-12-19 11:40 UTC (permalink / raw
  To: gentoo-commits

commit:     adbee2ba256f3bef1d486a9482153e363219a8e4
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 19 11:39:51 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Dec 19 11:40:13 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=adbee2ba

sys-libs/glibc: Remove old

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.34-r2.ebuild | 1591 -----------------------------------
 2 files changed, 1592 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 0dd6d9f18599..33a1f7f7b720 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,7 +14,6 @@ DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6
 DIST glibc-2.33-patches-4.tar.xz 60124 BLAKE2B a7a99f39c16df241745772c31b10946dc44c51e6c09f8a447b905e7dd6ba529aee08f66a581431453c6665485ac1848861559aa3f0aaba8c2061c1f1eb77d9be SHA512 05c33dc465a98097f836783bb5037dfa14b3a2c0c140014f642ea72954222ae919fe2db9573ee70ca9c1881b3b59dd4b815a8f39f331494fa12951c9012797ef
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
-DIST glibc-2.34-patches-5.tar.xz 56832 BLAKE2B e5f5e8e41551d9f90355e9fc854e541cdcd5dd172e12dafa84256b7aeb999c0980ec6e7299701b78b0257980f5cf91019edfdf9796bec6b886434aa1960b2d6c SHA512 bc56fe2870629700d931150e1ebdc6e9b3318e8dabf5491d3645efd4db11032e21562e9276d97fc052c45362bfbca7f3d80d93277c2bf8aa3e05a5001df75c60
 DIST glibc-2.34-patches-6.tar.xz 58396 BLAKE2B c25696e2aceef9ea4724716acde377d91b8a76b2edca2b293fcd6c89f635f63a612f8c1ecd861367b1394ebacc4b0151b0c6b68c2b08a7bde3a54a76400f35c5 SHA512 343922492e448d978dbcad1718804f892d002b6d4ce366da4cf571d97145ed850fb4b2862645681f487a9a18a77ea48f23010c0c61ea7cf914d26fd149b8271d
 DIST glibc-2.34-patches-8.tar.xz 61284 BLAKE2B a042d3bfd85cb9732f033eb1489fc4a9d5b42ec599bb320a97a9633047819d1d02b2f00dce601ddb02036f8bf0d67f9b0d6463785965db72d9ac2ce13765fa07 SHA512 1d92abb82ae404b90841217bba3b1ccb7e03799e5f21656b0a2eaaf06bd4a5a2f0fd7ebf927acc72fce0e2af6bb1a2e8658bac431423d07e75dce1f2868bd029
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624

diff --git a/sys-libs/glibc/glibc-2.34-r2.ebuild b/sys-libs/glibc/glibc-2.34-r2.ebuild
deleted file mode 100644
index dd50e8578a35..000000000000
--- a/sys-libs/glibc/glibc-2.34-r2.ebuild
+++ /dev/null
@@ -1,1591 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
-# on upgrades as people migrate to libxcrypt.
-# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
-PYTHON_COMPAT=( python3_{7,8,9} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=5
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			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)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; 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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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."
-				break
-			fi
-		done
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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 . -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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-12-19 11:40 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-12-19 11:40 UTC (permalink / raw
  To: gentoo-commits

commit:     ce37af0cf987d22165d61ec2ae578fae809e89c8
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 19 11:39:14 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Dec 19 11:40:10 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ce37af0c

sys-libs/glibc: Re-keyword 2.34-r4

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r4.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.34-r4.ebuild b/sys-libs/glibc/glibc-2.34-r4.ebuild
index 2a827a3494aa..4346f19004c8 100644
--- a/sys-libs/glibc/glibc-2.34-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r4.ebuild
@@ -29,8 +29,7 @@ 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=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2021-12-29 19:31 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2021-12-29 19:31 UTC (permalink / raw
  To: gentoo-commits

commit:     3f74b59c3c9aaecadddf9625f1e38086565f7bc6
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 29 19:29:05 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Dec 29 19:31:09 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f74b59c

sys-libs/glibc: Bugfix, against false errors in last minute run test

If there is a ld.so in a subdirectory of the libdir, it might have been
picked first ...

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r4.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.34-r4.ebuild b/sys-libs/glibc/glibc-2.34-r4.ebuild
index 4346f19004c8..88f72ad1d7db 100644
--- a/sys-libs/glibc/glibc-2.34-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r4.ebuild
@@ -1546,7 +1546,7 @@ glibc_sanity_check() {
 
 	# first let's find the actual dynamic linker here
 	# symlinks may point to the wrong abi
-	local newldso=$(find . -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) ...
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2cb4bf86808c..19d0bf001397 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1539,7 +1539,7 @@ glibc_sanity_check() {
 
 	# first let's find the actual dynamic linker here
 	# symlinks may point to the wrong abi
-	local newldso=$(find . -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) ...
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-01-04 11:49 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-01-04 11:49 UTC (permalink / raw
  To: gentoo-commits

commit:     5ec1d824d215780c826545fb0c5224ea350fe319
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  4 11:48:55 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jan  4 11:49:08 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5ec1d824

sys-libs/glibc: 2.34 patchlevel 9 bump

Contains a nonstandard patchset by azanella to fix the regressions when
a 32bit qemu is running on a 64bit architecture.

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.34-r5.ebuild | 1646 +++++++++++++++++++++++++++++++++++
 2 files changed, 1647 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 33a1f7f7b720..b9ecf5649464 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,6 +16,7 @@ DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf00
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-6.tar.xz 58396 BLAKE2B c25696e2aceef9ea4724716acde377d91b8a76b2edca2b293fcd6c89f635f63a612f8c1ecd861367b1394ebacc4b0151b0c6b68c2b08a7bde3a54a76400f35c5 SHA512 343922492e448d978dbcad1718804f892d002b6d4ce366da4cf571d97145ed850fb4b2862645681f487a9a18a77ea48f23010c0c61ea7cf914d26fd149b8271d
 DIST glibc-2.34-patches-8.tar.xz 61284 BLAKE2B a042d3bfd85cb9732f033eb1489fc4a9d5b42ec599bb320a97a9633047819d1d02b2f00dce601ddb02036f8bf0d67f9b0d6463785965db72d9ac2ce13765fa07 SHA512 1d92abb82ae404b90841217bba3b1ccb7e03799e5f21656b0a2eaaf06bd4a5a2f0fd7ebf927acc72fce0e2af6bb1a2e8658bac431423d07e75dce1f2868bd029
+DIST glibc-2.34-patches-9.tar.xz 89544 BLAKE2B 40ce44ac159e71ab868f957bb739ff2d29f7515a21b624c6e3b7690c15e796cb380d1344ebf319edd565c6778041b11de4584286a80e0a06fe37e5f5d93943f3 SHA512 62485a85e0e2042f5bedd12c9ffd562d1b3b3ba3e22efa6dbda9c62b3304a088cbc0de4f2adc4f2fa333a7644b22204b3bf4efa2b8524ac89cea7a8452a31778
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.34-r5.ebuild b/sys-libs/glibc/glibc-2.34-r5.ebuild
new file mode 100644
index 000000000000..fb6c5dcef52c
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.34-r5.ebuild
@@ -0,0 +1,1646 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
+# on upgrades as people migrate to libxcrypt.
+# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
+PYTHON_COMPAT=( python3_{7,8,9} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=9
+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=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 +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
+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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			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)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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.
+
+		local current_binutils_path=$(binutils-config -B)
+		local current_gcc_path=$(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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; 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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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."
+				break
+			fi
+		done
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-01-05  5:24 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-01-05  5:24 UTC (permalink / raw
  To: gentoo-commits

commit:     9d85b965ec43539802a528545eb131dd449ea6c0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  5 05:24:27 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jan  5 05:24:27 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9d85b965

sys-libs/glibc: Stabilize 2.33-r7 sparc, #809410

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r7.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild b/sys-libs/glibc/glibc-2.33-r7.ebuild
index 20390ea8ba2a..9c12fe15458e 100644
--- a/sys-libs/glibc/glibc-2.33-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r7.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -26,7 +26,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-01-05 21:15 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-01-05 21:15 UTC (permalink / raw
  To: gentoo-commits

commit:     14d493c63b2f6b8b558be3e918fc4a1752447b79
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  5 21:14:57 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jan  5 21:15:16 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=14d493c6

sys-libs/glibc: Revbump, add header fix from floppym

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest                                       | 2 +-
 sys-libs/glibc/{glibc-2.34-r5.ebuild => glibc-2.34-r6.ebuild} | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index b9ecf5649464..214b40362a71 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,9 +14,9 @@ DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6
 DIST glibc-2.33-patches-4.tar.xz 60124 BLAKE2B a7a99f39c16df241745772c31b10946dc44c51e6c09f8a447b905e7dd6ba529aee08f66a581431453c6665485ac1848861559aa3f0aaba8c2061c1f1eb77d9be SHA512 05c33dc465a98097f836783bb5037dfa14b3a2c0c140014f642ea72954222ae919fe2db9573ee70ca9c1881b3b59dd4b815a8f39f331494fa12951c9012797ef
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
+DIST glibc-2.34-patches-10.tar.xz 89816 BLAKE2B c396c568804a17cf78a0da945a3db7b3740eebcd676cbb9b007bb7226c209620e5aaf533c397b7276c0a02f577d58e5f84c167a3ac6cea336d73cbe47aceb3c6 SHA512 7aa72816ef7f46f206ef6c18825423dd48e4bfe9bfbe9c2a4f760c53fc28bf6894374ee14d3212ef9478359e2c25cbdda2c062c7c41de5025850699b41661b95
 DIST glibc-2.34-patches-6.tar.xz 58396 BLAKE2B c25696e2aceef9ea4724716acde377d91b8a76b2edca2b293fcd6c89f635f63a612f8c1ecd861367b1394ebacc4b0151b0c6b68c2b08a7bde3a54a76400f35c5 SHA512 343922492e448d978dbcad1718804f892d002b6d4ce366da4cf571d97145ed850fb4b2862645681f487a9a18a77ea48f23010c0c61ea7cf914d26fd149b8271d
 DIST glibc-2.34-patches-8.tar.xz 61284 BLAKE2B a042d3bfd85cb9732f033eb1489fc4a9d5b42ec599bb320a97a9633047819d1d02b2f00dce601ddb02036f8bf0d67f9b0d6463785965db72d9ac2ce13765fa07 SHA512 1d92abb82ae404b90841217bba3b1ccb7e03799e5f21656b0a2eaaf06bd4a5a2f0fd7ebf927acc72fce0e2af6bb1a2e8658bac431423d07e75dce1f2868bd029
-DIST glibc-2.34-patches-9.tar.xz 89544 BLAKE2B 40ce44ac159e71ab868f957bb739ff2d29f7515a21b624c6e3b7690c15e796cb380d1344ebf319edd565c6778041b11de4584286a80e0a06fe37e5f5d93943f3 SHA512 62485a85e0e2042f5bedd12c9ffd562d1b3b3ba3e22efa6dbda9c62b3304a088cbc0de4f2adc4f2fa333a7644b22204b3bf4efa2b8524ac89cea7a8452a31778
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.34-r5.ebuild b/sys-libs/glibc/glibc-2.34-r6.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.34-r5.ebuild
rename to sys-libs/glibc/glibc-2.34-r6.ebuild
index fb6c5dcef52c..791edb245a0f 100644
--- a/sys-libs/glibc/glibc-2.34-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r6.ebuild
@@ -23,7 +23,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=9
+PATCH_VER=10
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-01-05 21:16 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-01-05 21:16 UTC (permalink / raw
  To: gentoo-commits

commit:     0c221f0fa9884cc179320d1467dc302b37d9f750
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  5 21:16:27 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jan  5 21:16:27 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0c221f0f

sys-libs/glibc: Remove old

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas K. Huettel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 -
 sys-libs/glibc/glibc-2.33-r1.ebuild | 1521 ---------------------------------
 sys-libs/glibc/glibc-2.34-r3.ebuild | 1602 -----------------------------------
 3 files changed, 3125 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 214b40362a71..53275b6e62d2 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -11,11 +11,9 @@ DIST glibc-2.31-patches-9.tar.xz 74712 BLAKE2B 62991b67de4def4cca944e8420d2f0139
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a65f06b22fc5a04aa631b76b3016842365006399715531ee693f3519720edcebef7884247f2f8c19e3518c1ddafab7cc SHA512 5240bc3a6df46d12c03ea4ce7b1a0df85301256ae3bd003fd04c61dadaaec34998873bf20544d891f6eedf896302bb916010aebc1d8d646a3cce09a93b533d0b
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
-DIST glibc-2.33-patches-4.tar.xz 60124 BLAKE2B a7a99f39c16df241745772c31b10946dc44c51e6c09f8a447b905e7dd6ba529aee08f66a581431453c6665485ac1848861559aa3f0aaba8c2061c1f1eb77d9be SHA512 05c33dc465a98097f836783bb5037dfa14b3a2c0c140014f642ea72954222ae919fe2db9573ee70ca9c1881b3b59dd4b815a8f39f331494fa12951c9012797ef
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-10.tar.xz 89816 BLAKE2B c396c568804a17cf78a0da945a3db7b3740eebcd676cbb9b007bb7226c209620e5aaf533c397b7276c0a02f577d58e5f84c167a3ac6cea336d73cbe47aceb3c6 SHA512 7aa72816ef7f46f206ef6c18825423dd48e4bfe9bfbe9c2a4f760c53fc28bf6894374ee14d3212ef9478359e2c25cbdda2c062c7c41de5025850699b41661b95
-DIST glibc-2.34-patches-6.tar.xz 58396 BLAKE2B c25696e2aceef9ea4724716acde377d91b8a76b2edca2b293fcd6c89f635f63a612f8c1ecd861367b1394ebacc4b0151b0c6b68c2b08a7bde3a54a76400f35c5 SHA512 343922492e448d978dbcad1718804f892d002b6d4ce366da4cf571d97145ed850fb4b2862645681f487a9a18a77ea48f23010c0c61ea7cf914d26fd149b8271d
 DIST glibc-2.34-patches-8.tar.xz 61284 BLAKE2B a042d3bfd85cb9732f033eb1489fc4a9d5b42ec599bb320a97a9633047819d1d02b2f00dce601ddb02036f8bf0d67f9b0d6463785965db72d9ac2ce13765fa07 SHA512 1d92abb82ae404b90841217bba3b1ccb7e03799e5f21656b0a2eaaf06bd4a5a2f0fd7ebf927acc72fce0e2af6bb1a2e8658bac431423d07e75dce1f2868bd029
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238

diff --git a/sys-libs/glibc/glibc-2.33-r1.ebuild b/sys-libs/glibc/glibc-2.33-r1.ebuild
deleted file mode 100644
index cdbca06cc5d5..000000000000
--- a/sys-libs/glibc/glibc-2.33-r1.ebuild
+++ /dev/null
@@ -1,1521 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9,10} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=4
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-LOCALE_GEN_VER=2.10
-
-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 )"
-
-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"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-1.3.1
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-1.3.1
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
-}
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins posix/gai.conf nss/nsswitch.conf
-
-	# Gentoo-specific
-	newins "${FILESDIR}"/host.conf-1 host.conf
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# https://bugs.gentoo.org/753740
-		rm "${EROOT}"/usr/lib/locale || die
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.34-r3.ebuild b/sys-libs/glibc/glibc-2.34-r3.ebuild
deleted file mode 100644
index b65194c38f6f..000000000000
--- a/sys-libs/glibc/glibc-2.34-r3.ebuild
+++ /dev/null
@@ -1,1602 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
-# on upgrades as people migrate to libxcrypt.
-# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
-PYTHON_COMPAT=( python3_{7,8,9} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=6
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 +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
-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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			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)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; 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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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."
-				break
-			fi
-		done
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	# Apply patch to allow conditional disabling of clone3
-	eapply "${FILESDIR}"/${PN}-2.34-make-clone3-syscall-optional.patch
-
-	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
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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 . -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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-01-12 23:00 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-01-12 23:00 UTC (permalink / raw
  To: gentoo-commits

commit:     33d1e367129c3ddef0558e989fbd75a8a39738ea
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 12 22:00:13 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jan 12 23:00:07 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=33d1e367

sys-libs/glibc: 2.34 patchset 11 and re-keyword

Bug: https://bugs.gentoo.org/681790
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             | 2 +-
 sys-libs/glibc/glibc-2.34-r6.ebuild | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 53275b6e62d2..0983d08c16a3 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -13,7 +13,7 @@ DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
-DIST glibc-2.34-patches-10.tar.xz 89816 BLAKE2B c396c568804a17cf78a0da945a3db7b3740eebcd676cbb9b007bb7226c209620e5aaf533c397b7276c0a02f577d58e5f84c167a3ac6cea336d73cbe47aceb3c6 SHA512 7aa72816ef7f46f206ef6c18825423dd48e4bfe9bfbe9c2a4f760c53fc28bf6894374ee14d3212ef9478359e2c25cbdda2c062c7c41de5025850699b41661b95
+DIST glibc-2.34-patches-11.tar.xz 90452 BLAKE2B 86d0186cfa2684bf772697b8385c05338b91b220ac56f28d4aa20e448f94b8cbf4475c8bfe134945b8ad66c0361f4764da9a6fe0c7b1ad3de88166ffc42b7ed1 SHA512 b0bc7306d64af824a6d85e61b0a3614c3976e57efac130b36b356f6f1088c184638c12723aab108c17e6cb6264d62255707f47645e6d86a0b54345437e1ce343
 DIST glibc-2.34-patches-8.tar.xz 61284 BLAKE2B a042d3bfd85cb9732f033eb1489fc4a9d5b42ec599bb320a97a9633047819d1d02b2f00dce601ddb02036f8bf0d67f9b0d6463785965db72d9ac2ce13765fa07 SHA512 1d92abb82ae404b90841217bba3b1ccb7e03799e5f21656b0a2eaaf06bd4a5a2f0fd7ebf927acc72fce0e2af6bb1a2e8658bac431423d07e75dce1f2868bd029
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238

diff --git a/sys-libs/glibc/glibc-2.34-r6.ebuild b/sys-libs/glibc/glibc-2.34-r6.ebuild
index 791edb245a0f..eaae05f82915 100644
--- a/sys-libs/glibc/glibc-2.34-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r6.ebuild
@@ -23,14 +23,13 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=10
+PATCH_VER=11
 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=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-01-15 19:36 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-01-15 19:36 UTC (permalink / raw
  To: gentoo-commits

commit:     230c414ce4f93455d6e0e553312b2bbdfd58477d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 15 19:35:48 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jan 15 19:36:21 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=230c414c

sys-libs/glibc: XFAIL 3 more tests

Bug: https://bugs.gentoo.org/831267
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r6.ebuild | 6 ++++++
 sys-libs/glibc/glibc-9999.ebuild    | 8 +++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r6.ebuild b/sys-libs/glibc/glibc-2.34-r6.ebuild
index eaae05f82915..b1093aed0f13 100644
--- a/sys-libs/glibc/glibc-2.34-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r6.ebuild
@@ -181,6 +181,12 @@ XFAIL_TEST_LIST=(
 	# 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
 )
 
 #

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 19d0bf001397..80dd186c1af6 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -182,6 +182,12 @@ XFAIL_TEST_LIST=(
 	# 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
 )
 
 #


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-01-18 22:12 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-01-18 22:12 UTC (permalink / raw
  To: gentoo-commits

commit:     f8b6717bf4be84e6b2458b45387bc3e21da49c72
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 18 22:10:29 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jan 18 22:12:17 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8b6717b

sys-libs/glibc: Update 2.33 with new ebuild features, unkeyworded -r8

This is only preparation for a -r9 with a new patchset.

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r8.ebuild | 1631 +++++++++++++++++++++++++++++++++++
 1 file changed, 1631 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.33-r8.ebuild b/sys-libs/glibc/glibc-2.33-r8.ebuild
new file mode 100644
index 000000000000..6d5339c15907
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.33-r8.ebuild
@@ -0,0 +1,1631 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
+# on upgrades as people migrate to libxcrypt.
+# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
+PYTHON_COMPAT=( python3_{7,8,9} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=6
+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"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+LOCALE_GEN_VER=2.22
+
+GLIBC_SYSTEMD_VER=20210814
+
+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 systemd systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-1.3.1
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-1.3.1
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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.
+
+		local current_binutils_path=$(binutils-config -B)
+		local current_gcc_path=$(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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; 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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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."
+				break
+			fi
+		done
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-01-24 19:53 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-01-24 19:53 UTC (permalink / raw
  To: gentoo-commits

commit:     376d58482297aa1c5efdf9ff8e9e3b65460d44e4
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 24 19:53:15 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jan 24 19:53:34 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=376d5848

sys-libs/glibc: 2.34 patchset bump

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.34-r7.ebuild | 1651 +++++++++++++++++++++++++++++++++++
 2 files changed, 1652 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 0983d08c16a3..0b69d246aafb 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,6 +14,7 @@ DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-11.tar.xz 90452 BLAKE2B 86d0186cfa2684bf772697b8385c05338b91b220ac56f28d4aa20e448f94b8cbf4475c8bfe134945b8ad66c0361f4764da9a6fe0c7b1ad3de88166ffc42b7ed1 SHA512 b0bc7306d64af824a6d85e61b0a3614c3976e57efac130b36b356f6f1088c184638c12723aab108c17e6cb6264d62255707f47645e6d86a0b54345437e1ce343
+DIST glibc-2.34-patches-12.tar.xz 114620 BLAKE2B 46df412e1c20cd2a42115d89a6fd4e25715fcd4e8cd6adda2dfdf384374d1e778b28168e2a4989f06abcfdcd0eec0f096472b198ed51c0b370bec950c44e0867 SHA512 0f9161caec297450cb403208980e9f62f9b29008b04f300f67c99fa37741f169f09d9886a896e1e95ad90a0ede91646150942aadf2724454987c7b3c921432e1
 DIST glibc-2.34-patches-8.tar.xz 61284 BLAKE2B a042d3bfd85cb9732f033eb1489fc4a9d5b42ec599bb320a97a9633047819d1d02b2f00dce601ddb02036f8bf0d67f9b0d6463785965db72d9ac2ce13765fa07 SHA512 1d92abb82ae404b90841217bba3b1ccb7e03799e5f21656b0a2eaaf06bd4a5a2f0fd7ebf927acc72fce0e2af6bb1a2e8658bac431423d07e75dce1f2868bd029
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238

diff --git a/sys-libs/glibc/glibc-2.34-r7.ebuild b/sys-libs/glibc/glibc-2.34-r7.ebuild
new file mode 100644
index 000000000000..d7d47503ba8b
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.34-r7.ebuild
@@ -0,0 +1,1651 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
+# on upgrades as people migrate to libxcrypt.
+# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
+PYTHON_COMPAT=( python3_{7,8,9} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=12
+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"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 +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
+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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			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)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	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}
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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.
+
+		local current_binutils_path=$(binutils-config -B)
+		local current_gcc_path=$(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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; 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!"
+		fi
+
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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."
+				break
+			fi
+		done
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-01-24 19:54 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-01-24 19:54 UTC (permalink / raw
  To: gentoo-commits

commit:     b5d899e146d5fc43cf7d5c8635d1df2d4c9dea6a
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 24 19:54:27 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jan 24 19:54:27 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b5d899e1

sys-libs/glibc: Remove old

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.34-r4.ebuild | 1645 -----------------------------------
 2 files changed, 1646 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 0b69d246aafb..19c45b4cde46 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,7 +15,6 @@ DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf00
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-11.tar.xz 90452 BLAKE2B 86d0186cfa2684bf772697b8385c05338b91b220ac56f28d4aa20e448f94b8cbf4475c8bfe134945b8ad66c0361f4764da9a6fe0c7b1ad3de88166ffc42b7ed1 SHA512 b0bc7306d64af824a6d85e61b0a3614c3976e57efac130b36b356f6f1088c184638c12723aab108c17e6cb6264d62255707f47645e6d86a0b54345437e1ce343
 DIST glibc-2.34-patches-12.tar.xz 114620 BLAKE2B 46df412e1c20cd2a42115d89a6fd4e25715fcd4e8cd6adda2dfdf384374d1e778b28168e2a4989f06abcfdcd0eec0f096472b198ed51c0b370bec950c44e0867 SHA512 0f9161caec297450cb403208980e9f62f9b29008b04f300f67c99fa37741f169f09d9886a896e1e95ad90a0ede91646150942aadf2724454987c7b3c921432e1
-DIST glibc-2.34-patches-8.tar.xz 61284 BLAKE2B a042d3bfd85cb9732f033eb1489fc4a9d5b42ec599bb320a97a9633047819d1d02b2f00dce601ddb02036f8bf0d67f9b0d6463785965db72d9ac2ce13765fa07 SHA512 1d92abb82ae404b90841217bba3b1ccb7e03799e5f21656b0a2eaaf06bd4a5a2f0fd7ebf927acc72fce0e2af6bb1a2e8658bac431423d07e75dce1f2868bd029
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.34-r4.ebuild b/sys-libs/glibc/glibc-2.34-r4.ebuild
deleted file mode 100644
index 88f72ad1d7db..000000000000
--- a/sys-libs/glibc/glibc-2.34-r4.ebuild
+++ /dev/null
@@ -1,1645 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
-# on upgrades as people migrate to libxcrypt.
-# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
-PYTHON_COMPAT=( python3_{7,8,9} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=8
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 +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
-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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			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)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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.
-
-		local current_binutils_path=$(binutils-config -B)
-		local current_gcc_path=$(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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; 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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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."
-				break
-			fi
-		done
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	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
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-01-25 13:13 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-01-25 13:13 UTC (permalink / raw
  To: gentoo-commits

commit:     32cacd85af01e3a00b5fbe4d121c70db56f3e4be
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 25 13:11:59 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jan 25 13:13:06 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=32cacd85

sys-libs/glibc: 2.33 patchlevel 7 bump

Includes fixes for CVE-2021-3998, CVE-2021-3999, CVE-2022-23218, CVE-2022-23219

Bug: https://bugs.gentoo.org/831212
Bug: https://bugs.gentoo.org/831096
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest                                       | 1 +
 sys-libs/glibc/{glibc-2.33-r8.ebuild => glibc-2.33-r9.ebuild} | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 19c45b4cde46..92c058da399b 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -12,6 +12,7 @@ DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d
 DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a65f06b22fc5a04aa631b76b3016842365006399715531ee693f3519720edcebef7884247f2f8c19e3518c1ddafab7cc SHA512 5240bc3a6df46d12c03ea4ce7b1a0df85301256ae3bd003fd04c61dadaaec34998873bf20544d891f6eedf896302bb916010aebc1d8d646a3cce09a93b533d0b
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
+DIST glibc-2.33-patches-7.tar.xz 89652 BLAKE2B bbf317f3f32e26be0fd2fc8c4bf15fdfd52bb555e955c13a5e661ea1c08646d19ff7919229610a3a67bc9471ea4979783165697043d0cd0cc643252060daebc8 SHA512 023f927c4141819a65e127b36d3fda2ccb7ad55a14511a3709173d2d05049cb80cbbc527e0f470f01368d754afb369c3b18c5d708b888f12dc69d39ad73d62ff
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-11.tar.xz 90452 BLAKE2B 86d0186cfa2684bf772697b8385c05338b91b220ac56f28d4aa20e448f94b8cbf4475c8bfe134945b8ad66c0361f4764da9a6fe0c7b1ad3de88166ffc42b7ed1 SHA512 b0bc7306d64af824a6d85e61b0a3614c3976e57efac130b36b356f6f1088c184638c12723aab108c17e6cb6264d62255707f47645e6d86a0b54345437e1ce343
 DIST glibc-2.34-patches-12.tar.xz 114620 BLAKE2B 46df412e1c20cd2a42115d89a6fd4e25715fcd4e8cd6adda2dfdf384374d1e778b28168e2a4989f06abcfdcd0eec0f096472b198ed51c0b370bec950c44e0867 SHA512 0f9161caec297450cb403208980e9f62f9b29008b04f300f67c99fa37741f169f09d9886a896e1e95ad90a0ede91646150942aadf2724454987c7b3c921432e1

diff --git a/sys-libs/glibc/glibc-2.33-r8.ebuild b/sys-libs/glibc/glibc-2.33-r9.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.33-r8.ebuild
rename to sys-libs/glibc/glibc-2.33-r9.ebuild
index 6d5339c15907..e92bacdf9b11 100644
--- a/sys-libs/glibc/glibc-2.33-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r9.ebuild
@@ -23,7 +23,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=6
+PATCH_VER=7
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-01-25 16:10 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-01-25 16:10 UTC (permalink / raw
  To: gentoo-commits

commit:     95f8efa1ed8f36a92f3c69591b86cefadc95dbc2
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 25 16:09:02 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jan 25 16:10:40 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=95f8efa1

sys-libs/glibc: Minor build fix

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r9.ebuild b/sys-libs/glibc/glibc-2.33-r9.ebuild
index e92bacdf9b11..761340587b4d 100644
--- a/sys-libs/glibc/glibc-2.33-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r9.ebuild
@@ -1532,7 +1532,7 @@ glibc_sanity_check() {
 
 	# 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)
+	local newldso=$(find . -maxdepth 1 -name 'ld-*so' -type f -print -quit)
 
 	einfo Last-minute run tests with ${newldso} in /$(get_libdir) ...
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-01-25 21:27 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-01-25 21:27 UTC (permalink / raw
  To: gentoo-commits

commit:     369ff899d26a0211b5014d8f9a47eba194a9e87a
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 25 21:27:28 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jan 25 21:27:43 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=369ff899

sys-libs/glibc: Rekeyworkd 2.33-r9 and 2.34-r7

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r9.ebuild | 2 +-
 sys-libs/glibc/glibc-2.34-r7.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33-r9.ebuild b/sys-libs/glibc/glibc-2.33-r9.ebuild
index 761340587b4d..aaa4a31c0742 100644
--- a/sys-libs/glibc/glibc-2.33-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r9.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi

diff --git a/sys-libs/glibc/glibc-2.34-r7.ebuild b/sys-libs/glibc/glibc-2.34-r7.ebuild
index d7d47503ba8b..a1ae8fcba23c 100644
--- a/sys-libs/glibc/glibc-2.34-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r7.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-01-27 14:13 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-01-27 14:13 UTC (permalink / raw
  To: gentoo-commits

commit:     7ba56d4da4e3fd2bc0d2c1012f2dc02e448c77d4
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 27 14:12:31 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Jan 27 14:13:19 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7ba56d4d

sys-libs/glibc: 2.33 patchset bump

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest                                        | 2 +-
 sys-libs/glibc/{glibc-2.33-r9.ebuild => glibc-2.33-r10.ebuild} | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 92c058da399b..49a7edf2703d 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -12,7 +12,7 @@ DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d
 DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a65f06b22fc5a04aa631b76b3016842365006399715531ee693f3519720edcebef7884247f2f8c19e3518c1ddafab7cc SHA512 5240bc3a6df46d12c03ea4ce7b1a0df85301256ae3bd003fd04c61dadaaec34998873bf20544d891f6eedf896302bb916010aebc1d8d646a3cce09a93b533d0b
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
-DIST glibc-2.33-patches-7.tar.xz 89652 BLAKE2B bbf317f3f32e26be0fd2fc8c4bf15fdfd52bb555e955c13a5e661ea1c08646d19ff7919229610a3a67bc9471ea4979783165697043d0cd0cc643252060daebc8 SHA512 023f927c4141819a65e127b36d3fda2ccb7ad55a14511a3709173d2d05049cb80cbbc527e0f470f01368d754afb369c3b18c5d708b888f12dc69d39ad73d62ff
+DIST glibc-2.33-patches-8.tar.xz 91220 BLAKE2B 1c9aeaf2d3a58e83aec8ea6eb19776dd05e16430f25de675b467ab18d4fb438374254d06b2072b4272d089237e5f11da6d94a84c38f588b79e94e26b650f6faf SHA512 58d3f444c50e64bbf867cbcc38f4281156c7da3878674038674e1c6706b90919468af9fbd424c2dd949bc2d7d6cb36ed7be2120bb957636cad6b76e56eb54031
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-11.tar.xz 90452 BLAKE2B 86d0186cfa2684bf772697b8385c05338b91b220ac56f28d4aa20e448f94b8cbf4475c8bfe134945b8ad66c0361f4764da9a6fe0c7b1ad3de88166ffc42b7ed1 SHA512 b0bc7306d64af824a6d85e61b0a3614c3976e57efac130b36b356f6f1088c184638c12723aab108c17e6cb6264d62255707f47645e6d86a0b54345437e1ce343
 DIST glibc-2.34-patches-12.tar.xz 114620 BLAKE2B 46df412e1c20cd2a42115d89a6fd4e25715fcd4e8cd6adda2dfdf384374d1e778b28168e2a4989f06abcfdcd0eec0f096472b198ed51c0b370bec950c44e0867 SHA512 0f9161caec297450cb403208980e9f62f9b29008b04f300f67c99fa37741f169f09d9886a896e1e95ad90a0ede91646150942aadf2724454987c7b3c921432e1

diff --git a/sys-libs/glibc/glibc-2.33-r9.ebuild b/sys-libs/glibc/glibc-2.33-r10.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.33-r9.ebuild
rename to sys-libs/glibc/glibc-2.33-r10.ebuild
index aaa4a31c0742..ada616094f9c 100644
--- a/sys-libs/glibc/glibc-2.33-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r10.ebuild
@@ -23,7 +23,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=7
+PATCH_VER=8
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-01-28 22:34 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-01-28 22:34 UTC (permalink / raw
  To: gentoo-commits

commit:     b51a935d61fcea6331f455dcb8a284d807992aef
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 28 22:34:14 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Jan 28 22:34:29 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b51a935d

sys-libs/glibc: --enable-static-pie is gone

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 80dd186c1af6..c026532e5353 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -47,7 +47,7 @@ SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${L
 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 +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"
+IUSE="audit caps cet +clone3 compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +static-libs suid systemd systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -1019,7 +1019,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)
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-01-29 16:07 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-01-29 16:07 UTC (permalink / raw
  To: gentoo-commits

commit:     851fead9d22cb53d4fa374fa442b2cc04ff2a6dd
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 29 16:06:52 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jan 29 16:07:28 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=851fead9

sys-libs/glibc: drop outdated checks for __thread support

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r10.ebuild | 35 -----------------------------------
 sys-libs/glibc/glibc-2.34-r7.ebuild  | 35 -----------------------------------
 sys-libs/glibc/glibc-9999.ebuild     | 35 -----------------------------------
 3 files changed, 105 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33-r10.ebuild b/sys-libs/glibc/glibc-2.33-r10.ebuild
index ada616094f9c..89ce950797d6 100644
--- a/sys-libs/glibc/glibc-2.33-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r10.ebuild
@@ -438,33 +438,6 @@ setup_flags() {
 	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}
-}
-
 use_multiarch() {
 	# Allow user to disable runtime arch detection in multilib.
 	use multiarch || return 1
@@ -783,14 +756,6 @@ sanity_prechecks() {
 
 	# When we actually have to compile something...
 	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; 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!"
-		fi
-
 		if [[ ${CTARGET} == *-linux* ]] ; then
 			local run_kv build_kv want_kv
 

diff --git a/sys-libs/glibc/glibc-2.34-r7.ebuild b/sys-libs/glibc/glibc-2.34-r7.ebuild
index a1ae8fcba23c..924a5a143215 100644
--- a/sys-libs/glibc/glibc-2.34-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r7.ebuild
@@ -450,33 +450,6 @@ setup_flags() {
 	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}
-}
-
 use_multiarch() {
 	# Allow user to disable runtime arch detection in multilib.
 	use multiarch || return 1
@@ -795,14 +768,6 @@ sanity_prechecks() {
 
 	# When we actually have to compile something...
 	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; 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!"
-		fi
-
 		if [[ ${CTARGET} == *-linux* ]] ; then
 			local run_kv build_kv want_kv
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index c026532e5353..f47aef2712e1 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -443,33 +443,6 @@ setup_flags() {
 	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}
-}
-
 use_multiarch() {
 	# Allow user to disable runtime arch detection in multilib.
 	use multiarch || return 1
@@ -788,14 +761,6 @@ sanity_prechecks() {
 
 	# When we actually have to compile something...
 	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; 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!"
-		fi
-
 		if [[ ${CTARGET} == *-linux* ]] ; then
 			local run_kv build_kv want_kv
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-01-29 17:49 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-01-29 17:49 UTC (permalink / raw
  To: gentoo-commits

commit:     55b55f614b0ff516547d4ffd111a7a9efa27097a
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 29 17:49:35 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jan 29 17:49:46 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=55b55f61

sys-libs/glibc: Run sanity tests after setting up the environment

It makes no sense to use the wrong compiler, for example.

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f47aef2712e1..b97550bf18f0 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -260,8 +260,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
@@ -743,7 +743,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
@@ -809,9 +809,6 @@ upgrade_warning() {
 # pkg_pretend
 
 pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
 	upgrade_warning
 }
 
@@ -823,13 +820,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


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-01-31 23:03 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-01-31 23:03 UTC (permalink / raw
  To: gentoo-commits

commit:     ca83d3bddd1e33dfadba2511366ce7d70580f8aa
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 31 23:03:20 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jan 31 23:03:38 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ca83d3bd

sys-libs/glibc: 2.33 patchset bump

See-also: https://sourceware.org/pipermail/libc-alpha/2022-January/135929.html
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    1 +
 sys-libs/glibc/glibc-2.33-r11.ebuild | 1596 ++++++++++++++++++++++++++++++++++
 2 files changed, 1597 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 49a7edf2703d..5df9731c2262 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -13,6 +13,7 @@ DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33-patches-8.tar.xz 91220 BLAKE2B 1c9aeaf2d3a58e83aec8ea6eb19776dd05e16430f25de675b467ab18d4fb438374254d06b2072b4272d089237e5f11da6d94a84c38f588b79e94e26b650f6faf SHA512 58d3f444c50e64bbf867cbcc38f4281156c7da3878674038674e1c6706b90919468af9fbd424c2dd949bc2d7d6cb36ed7be2120bb957636cad6b76e56eb54031
+DIST glibc-2.33-patches-9.tar.xz 136692 BLAKE2B e89afdd1b9818c41a44bb60c8ae5850ac98a7dceddb40f880c56548af8c69ffd9db158a5884380723479e7b42ea5906c0dab16bc960cf72720327981e2fb808a SHA512 3c57566fbc9a099b161d33cad4ac98472d8668de88e913b17f7342c21473287692563fa8e1e4064fc75fc8902b00dcbc66f0a9144286bb11dab6e31a3b1fd969
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-11.tar.xz 90452 BLAKE2B 86d0186cfa2684bf772697b8385c05338b91b220ac56f28d4aa20e448f94b8cbf4475c8bfe134945b8ad66c0361f4764da9a6fe0c7b1ad3de88166ffc42b7ed1 SHA512 b0bc7306d64af824a6d85e61b0a3614c3976e57efac130b36b356f6f1088c184638c12723aab108c17e6cb6264d62255707f47645e6d86a0b54345437e1ce343
 DIST glibc-2.34-patches-12.tar.xz 114620 BLAKE2B 46df412e1c20cd2a42115d89a6fd4e25715fcd4e8cd6adda2dfdf384374d1e778b28168e2a4989f06abcfdcd0eec0f096472b198ed51c0b370bec950c44e0867 SHA512 0f9161caec297450cb403208980e9f62f9b29008b04f300f67c99fa37741f169f09d9886a896e1e95ad90a0ede91646150942aadf2724454987c7b3c921432e1

diff --git a/sys-libs/glibc/glibc-2.33-r11.ebuild b/sys-libs/glibc/glibc-2.33-r11.ebuild
new file mode 100644
index 000000000000..46418cbd9cbc
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.33-r11.ebuild
@@ -0,0 +1,1596 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
+# on upgrades as people migrate to libxcrypt.
+# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
+PYTHON_COMPAT=( python3_{7,8,9} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=9
+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"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+LOCALE_GEN_VER=2.22
+
+GLIBC_SYSTEMD_VER=20210814
+
+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 systemd systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-1.3.1
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-1.3.1
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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.
+
+		local current_binutils_path=$(binutils-config -B)
+		local current_gcc_path=$(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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; then
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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."
+				break
+			fi
+		done
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-01 20:36 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-02-01 20:36 UTC (permalink / raw
  To: gentoo-commits

commit:     ed16a6d30f5b93f5a8efdecdfc2ca2669c832869
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  1 20:36:01 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Feb  1 20:36:23 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ed16a6d3

sys-libs/glibc: 2.33 patchset bump, again

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest                                         | 2 +-
 sys-libs/glibc/{glibc-2.33-r11.ebuild => glibc-2.33-r12.ebuild} | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 5df9731c2262..3216f9dd18ef 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -11,9 +11,9 @@ DIST glibc-2.31-patches-9.tar.xz 74712 BLAKE2B 62991b67de4def4cca944e8420d2f0139
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a65f06b22fc5a04aa631b76b3016842365006399715531ee693f3519720edcebef7884247f2f8c19e3518c1ddafab7cc SHA512 5240bc3a6df46d12c03ea4ce7b1a0df85301256ae3bd003fd04c61dadaaec34998873bf20544d891f6eedf896302bb916010aebc1d8d646a3cce09a93b533d0b
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
+DIST glibc-2.33-patches-10.tar.xz 138468 BLAKE2B a0d3acf56d6ba56a86bc0cc57e7459651488e3484a22eae82a19d746df55fbd9408a2a8be725f5dddaee50dd8bf3306226123eefd77dc6df5b5df98de3ff9ef6 SHA512 e7dd26a26b001c84ec8a1bb243437f1b9ce376aa2ed42c97ea32aa0f4e45ce234b95f260cb111e0fe1687b8cc76b86c2df35e44e98d60d2a1b327298697b021b
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33-patches-8.tar.xz 91220 BLAKE2B 1c9aeaf2d3a58e83aec8ea6eb19776dd05e16430f25de675b467ab18d4fb438374254d06b2072b4272d089237e5f11da6d94a84c38f588b79e94e26b650f6faf SHA512 58d3f444c50e64bbf867cbcc38f4281156c7da3878674038674e1c6706b90919468af9fbd424c2dd949bc2d7d6cb36ed7be2120bb957636cad6b76e56eb54031
-DIST glibc-2.33-patches-9.tar.xz 136692 BLAKE2B e89afdd1b9818c41a44bb60c8ae5850ac98a7dceddb40f880c56548af8c69ffd9db158a5884380723479e7b42ea5906c0dab16bc960cf72720327981e2fb808a SHA512 3c57566fbc9a099b161d33cad4ac98472d8668de88e913b17f7342c21473287692563fa8e1e4064fc75fc8902b00dcbc66f0a9144286bb11dab6e31a3b1fd969
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-11.tar.xz 90452 BLAKE2B 86d0186cfa2684bf772697b8385c05338b91b220ac56f28d4aa20e448f94b8cbf4475c8bfe134945b8ad66c0361f4764da9a6fe0c7b1ad3de88166ffc42b7ed1 SHA512 b0bc7306d64af824a6d85e61b0a3614c3976e57efac130b36b356f6f1088c184638c12723aab108c17e6cb6264d62255707f47645e6d86a0b54345437e1ce343
 DIST glibc-2.34-patches-12.tar.xz 114620 BLAKE2B 46df412e1c20cd2a42115d89a6fd4e25715fcd4e8cd6adda2dfdf384374d1e778b28168e2a4989f06abcfdcd0eec0f096472b198ed51c0b370bec950c44e0867 SHA512 0f9161caec297450cb403208980e9f62f9b29008b04f300f67c99fa37741f169f09d9886a896e1e95ad90a0ede91646150942aadf2724454987c7b3c921432e1

diff --git a/sys-libs/glibc/glibc-2.33-r11.ebuild b/sys-libs/glibc/glibc-2.33-r12.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.33-r11.ebuild
rename to sys-libs/glibc/glibc-2.33-r12.ebuild
index 46418cbd9cbc..87a79a24f4cb 100644
--- a/sys-libs/glibc/glibc-2.33-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r12.ebuild
@@ -23,7 +23,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=9
+PATCH_VER=10
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-02  0:18 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-02-02  0:18 UTC (permalink / raw
  To: gentoo-commits

commit:     1163bc3430025489e4c73e57ef9709c7fa141f26
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Feb  2 00:17:40 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Feb  2 00:18:03 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1163bc34

sys-libs/glibc: Restore keywords of 2.33-r12

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r12.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r12.ebuild b/sys-libs/glibc/glibc-2.33-r12.ebuild
index 87a79a24f4cb..1200b7f4a1c3 100644
--- a/sys-libs/glibc/glibc-2.33-r12.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r12.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-03 23:49 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-02-03 23:49 UTC (permalink / raw
  To: gentoo-commits

commit:     7d711f502a5cf86ae5e73c466d647fed33d4ae4a
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  3 23:48:31 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Feb  3 23:49:28 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7d711f50

sys-libs/glibc: 2.35 version bump, no keywords

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          |    2 +
 sys-libs/glibc/glibc-2.35.ebuild | 1605 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 1607 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 3216f9dd18ef..e68137d5c97a 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,6 +18,8 @@ DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d91116
 DIST glibc-2.34-patches-11.tar.xz 90452 BLAKE2B 86d0186cfa2684bf772697b8385c05338b91b220ac56f28d4aa20e448f94b8cbf4475c8bfe134945b8ad66c0361f4764da9a6fe0c7b1ad3de88166ffc42b7ed1 SHA512 b0bc7306d64af824a6d85e61b0a3614c3976e57efac130b36b356f6f1088c184638c12723aab108c17e6cb6264d62255707f47645e6d86a0b54345437e1ce343
 DIST glibc-2.34-patches-12.tar.xz 114620 BLAKE2B 46df412e1c20cd2a42115d89a6fd4e25715fcd4e8cd6adda2dfdf384374d1e778b28168e2a4989f06abcfdcd0eec0f096472b198ed51c0b370bec950c44e0867 SHA512 0f9161caec297450cb403208980e9f62f9b29008b04f300f67c99fa37741f169f09d9886a896e1e95ad90a0ede91646150942aadf2724454987c7b3c921432e1
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
+DIST glibc-2.35-patches-1.tar.xz 19808 BLAKE2B 4128f2c58a4a0550bdfcafb955b480aa8cbcf605930e1ef537ddcda3c1dc052e7a2760d5844bb00a318576cb0d2ea374c6a9da90c902d93852357f23d440379b SHA512 5107dd0c0cea6ef645c20a9feff8be30787304afda092074985756d5033e66534adf1336f89d8a6f4390ede3fcdd8b1270ef0c6783811a9be43e0ff50d639a76
+DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff

diff --git a/sys-libs/glibc/glibc-2.35.ebuild b/sys-libs/glibc/glibc-2.35.ebuild
new file mode 100644
index 000000000000..3365dded67ed
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.35.ebuild
@@ -0,0 +1,1605 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
+# on upgrades as people migrate to libxcrypt.
+# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
+PYTHON_COMPAT=( python3_{7,8,9} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=1
+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=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 +clone3 compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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.
+
+		local current_binutils_path=$(binutils-config -B)
+		local current_gcc_path=$(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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; then
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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."
+				break
+			fi
+		done
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-05 12:43 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-02-05 12:43 UTC (permalink / raw
  To: gentoo-commits

commit:     71eedb79d09ee6d6848a38f2656489d5f6f8f07c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  4 22:41:53 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Feb  5 12:43:31 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=71eedb79

sys-libs/glibc: Remove old

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    1 -
 sys-libs/glibc/glibc-2.33-r10.ebuild | 1596 ----------------------------------
 2 files changed, 1597 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 8a88137b7863..caa8948ace7e 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,7 +14,6 @@ DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6
 DIST glibc-2.33-patches-10.tar.xz 138468 BLAKE2B a0d3acf56d6ba56a86bc0cc57e7459651488e3484a22eae82a19d746df55fbd9408a2a8be725f5dddaee50dd8bf3306226123eefd77dc6df5b5df98de3ff9ef6 SHA512 e7dd26a26b001c84ec8a1bb243437f1b9ce376aa2ed42c97ea32aa0f4e45ce234b95f260cb111e0fe1687b8cc76b86c2df35e44e98d60d2a1b327298697b021b
 DIST glibc-2.33-patches-11.tar.xz 143916 BLAKE2B ac13b3ccf9681bb6d3c35ecc33e268ea3f67c1809f916019e692dc83e3ce809402a45548da5ca6c7c30d2a45a2638f9fa4254c0355bd4c53bdb216f17aa4e28b SHA512 0ee1dfcf9574543d49ab4fbfe53571258422b6e82b9d12a33e411cee7e517821a4c45c24962b5120783a4efc898afdfa170d33486cc74d94c526bdd14cc84300
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
-DIST glibc-2.33-patches-8.tar.xz 91220 BLAKE2B 1c9aeaf2d3a58e83aec8ea6eb19776dd05e16430f25de675b467ab18d4fb438374254d06b2072b4272d089237e5f11da6d94a84c38f588b79e94e26b650f6faf SHA512 58d3f444c50e64bbf867cbcc38f4281156c7da3878674038674e1c6706b90919468af9fbd424c2dd949bc2d7d6cb36ed7be2120bb957636cad6b76e56eb54031
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-11.tar.xz 90452 BLAKE2B 86d0186cfa2684bf772697b8385c05338b91b220ac56f28d4aa20e448f94b8cbf4475c8bfe134945b8ad66c0361f4764da9a6fe0c7b1ad3de88166ffc42b7ed1 SHA512 b0bc7306d64af824a6d85e61b0a3614c3976e57efac130b36b356f6f1088c184638c12723aab108c17e6cb6264d62255707f47645e6d86a0b54345437e1ce343
 DIST glibc-2.34-patches-12.tar.xz 114620 BLAKE2B 46df412e1c20cd2a42115d89a6fd4e25715fcd4e8cd6adda2dfdf384374d1e778b28168e2a4989f06abcfdcd0eec0f096472b198ed51c0b370bec950c44e0867 SHA512 0f9161caec297450cb403208980e9f62f9b29008b04f300f67c99fa37741f169f09d9886a896e1e95ad90a0ede91646150942aadf2724454987c7b3c921432e1

diff --git a/sys-libs/glibc/glibc-2.33-r10.ebuild b/sys-libs/glibc/glibc-2.33-r10.ebuild
deleted file mode 100644
index 89ce950797d6..000000000000
--- a/sys-libs/glibc/glibc-2.33-r10.ebuild
+++ /dev/null
@@ -1,1596 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
-# on upgrades as people migrate to libxcrypt.
-# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
-PYTHON_COMPAT=( python3_{7,8,9} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=8
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-LOCALE_GEN_VER=2.22
-
-GLIBC_SYSTEMD_VER=20210814
-
-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 systemd systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-1.3.1
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-1.3.1
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	filter-flags '-fstack-protector*'
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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.
-
-		local current_binutils_path=$(binutils-config -B)
-		local current_gcc_path=$(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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; then
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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."
-				break
-			fi
-		done
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-05 12:43 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-02-05 12:43 UTC (permalink / raw
  To: gentoo-commits

commit:     06ae68263ebab3e79791b358c5280ea47c7b3c1f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  5 12:43:12 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Feb  5 12:43:37 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06ae6826

sys-libs/glibc: Remove old

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.34-r6.ebuild | 1651 -----------------------------------
 2 files changed, 1652 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 942503bc16c8..06ef132b1520 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,7 +15,6 @@ DIST glibc-2.33-patches-10.tar.xz 138468 BLAKE2B a0d3acf56d6ba56a86bc0cc57e74596
 DIST glibc-2.33-patches-11.tar.xz 143916 BLAKE2B ac13b3ccf9681bb6d3c35ecc33e268ea3f67c1809f916019e692dc83e3ce809402a45548da5ca6c7c30d2a45a2638f9fa4254c0355bd4c53bdb216f17aa4e28b SHA512 0ee1dfcf9574543d49ab4fbfe53571258422b6e82b9d12a33e411cee7e517821a4c45c24962b5120783a4efc898afdfa170d33486cc74d94c526bdd14cc84300
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
-DIST glibc-2.34-patches-11.tar.xz 90452 BLAKE2B 86d0186cfa2684bf772697b8385c05338b91b220ac56f28d4aa20e448f94b8cbf4475c8bfe134945b8ad66c0361f4764da9a6fe0c7b1ad3de88166ffc42b7ed1 SHA512 b0bc7306d64af824a6d85e61b0a3614c3976e57efac130b36b356f6f1088c184638c12723aab108c17e6cb6264d62255707f47645e6d86a0b54345437e1ce343
 DIST glibc-2.34-patches-12.tar.xz 114620 BLAKE2B 46df412e1c20cd2a42115d89a6fd4e25715fcd4e8cd6adda2dfdf384374d1e778b28168e2a4989f06abcfdcd0eec0f096472b198ed51c0b370bec950c44e0867 SHA512 0f9161caec297450cb403208980e9f62f9b29008b04f300f67c99fa37741f169f09d9886a896e1e95ad90a0ede91646150942aadf2724454987c7b3c921432e1
 DIST glibc-2.34-patches-13.tar.xz 135104 BLAKE2B 91fd2fecba36f558bb88025d3ce130b0df349c72284e999a9f65e6712e18eaaf53649a6e400194a47c55d144c22b55b42e8f313189fd2e124fef6b8ec8b1cb6d SHA512 1037d59352f0087fb6601aaf6972a92626d1d5e58b904b72d970903736efe2b93d5537e176ad3b65da322eace91a9d868dddb8d06c2396a23472117f1983b557
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624

diff --git a/sys-libs/glibc/glibc-2.34-r6.ebuild b/sys-libs/glibc/glibc-2.34-r6.ebuild
deleted file mode 100644
index b1093aed0f13..000000000000
--- a/sys-libs/glibc/glibc-2.34-r6.ebuild
+++ /dev/null
@@ -1,1651 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
-# on upgrades as people migrate to libxcrypt.
-# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
-PYTHON_COMPAT=( python3_{7,8,9} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=11
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 +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
-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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			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)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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.
-
-		local current_binutils_path=$(binutils-config -B)
-		local current_gcc_path=$(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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; 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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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."
-				break
-			fi
-		done
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	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
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-05 12:43 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-02-05 12:43 UTC (permalink / raw
  To: gentoo-commits

commit:     8130eac77ebc4e9ef512897ccae8f657760657ee
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  4 22:41:01 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Feb  5 12:43:28 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8130eac7

sys-libs/glibc: 2.33 patchlevel bump

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    1 +
 sys-libs/glibc/glibc-2.33-r13.ebuild | 1596 ++++++++++++++++++++++++++++++++++
 2 files changed, 1597 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index e68137d5c97a..8a88137b7863 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -12,6 +12,7 @@ DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d
 DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a65f06b22fc5a04aa631b76b3016842365006399715531ee693f3519720edcebef7884247f2f8c19e3518c1ddafab7cc SHA512 5240bc3a6df46d12c03ea4ce7b1a0df85301256ae3bd003fd04c61dadaaec34998873bf20544d891f6eedf896302bb916010aebc1d8d646a3cce09a93b533d0b
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST glibc-2.33-patches-10.tar.xz 138468 BLAKE2B a0d3acf56d6ba56a86bc0cc57e7459651488e3484a22eae82a19d746df55fbd9408a2a8be725f5dddaee50dd8bf3306226123eefd77dc6df5b5df98de3ff9ef6 SHA512 e7dd26a26b001c84ec8a1bb243437f1b9ce376aa2ed42c97ea32aa0f4e45ce234b95f260cb111e0fe1687b8cc76b86c2df35e44e98d60d2a1b327298697b021b
+DIST glibc-2.33-patches-11.tar.xz 143916 BLAKE2B ac13b3ccf9681bb6d3c35ecc33e268ea3f67c1809f916019e692dc83e3ce809402a45548da5ca6c7c30d2a45a2638f9fa4254c0355bd4c53bdb216f17aa4e28b SHA512 0ee1dfcf9574543d49ab4fbfe53571258422b6e82b9d12a33e411cee7e517821a4c45c24962b5120783a4efc898afdfa170d33486cc74d94c526bdd14cc84300
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33-patches-8.tar.xz 91220 BLAKE2B 1c9aeaf2d3a58e83aec8ea6eb19776dd05e16430f25de675b467ab18d4fb438374254d06b2072b4272d089237e5f11da6d94a84c38f588b79e94e26b650f6faf SHA512 58d3f444c50e64bbf867cbcc38f4281156c7da3878674038674e1c6706b90919468af9fbd424c2dd949bc2d7d6cb36ed7be2120bb957636cad6b76e56eb54031
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb

diff --git a/sys-libs/glibc/glibc-2.33-r13.ebuild b/sys-libs/glibc/glibc-2.33-r13.ebuild
new file mode 100644
index 000000000000..22241d65be89
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.33-r13.ebuild
@@ -0,0 +1,1596 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
+# on upgrades as people migrate to libxcrypt.
+# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
+PYTHON_COMPAT=( python3_{7,8,9} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=11
+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"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+LOCALE_GEN_VER=2.22
+
+GLIBC_SYSTEMD_VER=20210814
+
+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 systemd systemtap test vanilla"
+
+# Minimum kernel version that glibc requires
+MIN_KERN_VER="3.2.0"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-1.3.1
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-1.3.1
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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.
+
+		local current_binutils_path=$(binutils-config -B)
+		local current_gcc_path=$(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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; then
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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."
+				break
+			fi
+		done
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-05 12:43 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-02-05 12:43 UTC (permalink / raw
  To: gentoo-commits

commit:     0e67ef9f755ab5087e112001322df11f632fe2c0
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  5 12:42:20 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Feb  5 12:43:34 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0e67ef9f

sys-libs/glibc: 2.34 patchset bump

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.34-r8.ebuild | 1616 +++++++++++++++++++++++++++++++++++
 2 files changed, 1617 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index caa8948ace7e..942503bc16c8 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,6 +17,7 @@ DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf00
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-11.tar.xz 90452 BLAKE2B 86d0186cfa2684bf772697b8385c05338b91b220ac56f28d4aa20e448f94b8cbf4475c8bfe134945b8ad66c0361f4764da9a6fe0c7b1ad3de88166ffc42b7ed1 SHA512 b0bc7306d64af824a6d85e61b0a3614c3976e57efac130b36b356f6f1088c184638c12723aab108c17e6cb6264d62255707f47645e6d86a0b54345437e1ce343
 DIST glibc-2.34-patches-12.tar.xz 114620 BLAKE2B 46df412e1c20cd2a42115d89a6fd4e25715fcd4e8cd6adda2dfdf384374d1e778b28168e2a4989f06abcfdcd0eec0f096472b198ed51c0b370bec950c44e0867 SHA512 0f9161caec297450cb403208980e9f62f9b29008b04f300f67c99fa37741f169f09d9886a896e1e95ad90a0ede91646150942aadf2724454987c7b3c921432e1
+DIST glibc-2.34-patches-13.tar.xz 135104 BLAKE2B 91fd2fecba36f558bb88025d3ce130b0df349c72284e999a9f65e6712e18eaaf53649a6e400194a47c55d144c22b55b42e8f313189fd2e124fef6b8ec8b1cb6d SHA512 1037d59352f0087fb6601aaf6972a92626d1d5e58b904b72d970903736efe2b93d5537e176ad3b65da322eace91a9d868dddb8d06c2396a23472117f1983b557
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-2.35-patches-1.tar.xz 19808 BLAKE2B 4128f2c58a4a0550bdfcafb955b480aa8cbcf605930e1ef537ddcda3c1dc052e7a2760d5844bb00a318576cb0d2ea374c6a9da90c902d93852357f23d440379b SHA512 5107dd0c0cea6ef645c20a9feff8be30787304afda092074985756d5033e66534adf1336f89d8a6f4390ede3fcdd8b1270ef0c6783811a9be43e0ff50d639a76
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66

diff --git a/sys-libs/glibc/glibc-2.34-r8.ebuild b/sys-libs/glibc/glibc-2.34-r8.ebuild
new file mode 100644
index 000000000000..376702589b83
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.34-r8.ebuild
@@ -0,0 +1,1616 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
+# on upgrades as people migrate to libxcrypt.
+# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
+PYTHON_COMPAT=( python3_{7,8,9} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=13
+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"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 +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
+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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			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)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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.
+
+		local current_binutils_path=$(binutils-config -B)
+		local current_gcc_path=$(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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; then
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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."
+				break
+			fi
+		done
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-06  1:41 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-02-06  1:41 UTC (permalink / raw
  To: gentoo-commits

commit:     60199e4f9bad1cbde7ccac876d25997a367ed4c0
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Feb  6 01:41:27 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Feb  6 01:41:47 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=60199e4f

sys-libs/glibc: Re-keyword 2.33-r13

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r13.ebuild b/sys-libs/glibc/glibc-2.33-r13.ebuild
index 22241d65be89..7e490a4e0ccc 100644
--- a/sys-libs/glibc/glibc-2.33-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r13.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-06  2:13 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-02-06  2:13 UTC (permalink / raw
  To: gentoo-commits

commit:     1edb43d2e73384a4cf4d020c816faf26905a6d22
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Feb  6 02:12:49 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Feb  6 02:12:49 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1edb43d2

sys-libs/glibc: Re-keyword 2.34-r8

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r8.ebuild b/sys-libs/glibc/glibc-2.34-r8.ebuild
index 376702589b83..fd1d4147fd8a 100644
--- a/sys-libs/glibc/glibc-2.34-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r8.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-07  2:46 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-02-07  2:46 UTC (permalink / raw
  To: gentoo-commits

commit:     f58ea78c13b6078eade21a0de13e032e9ef49854
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  7 02:43:09 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Feb  7 02:45:29 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f58ea78c

sys-libs/glibc: re-enable SSP for m68k; drop obsolete option in 2.35/9999

- Re-enable SSP for m68k (it works now!) [0]
- Drop no-op/obsolete/removed '--enable-stackguard-randomization' [1]

But defer a decision on whether to make USE=ssp continue to
mean -fstack-protector-strong or change to -fstack-protector-all now that
test failure issues have veen fixed.

[0] https://sourceware.org/PR24202
[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=f294306ba1385b096f4e4cac9146a989f1e6d1c0

Bug: https://bugs.gentoo.org/832738
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35.ebuild | 18 +++---------------
 sys-libs/glibc/glibc-9999.ebuild | 24 ++++++------------------
 2 files changed, 9 insertions(+), 33 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.35.ebuild b/sys-libs/glibc/glibc-2.35.ebuild
index 3365dded67ed..39ebc6f3a02b 100644
--- a/sys-libs/glibc/glibc-2.35.ebuild
+++ b/sys-libs/glibc/glibc-2.35.ebuild
@@ -898,21 +898,9 @@ glibc_do_configure() {
 	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:

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index b97550bf18f0..39ebc6f3a02b 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -23,7 +23,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=2
+PATCH_VER=1
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then
@@ -148,13 +148,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+="
@@ -898,21 +898,9 @@ glibc_do_configure() {
 	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:


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-07  2:52 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-02-07  2:52 UTC (permalink / raw
  To: gentoo-commits

commit:     df1d19fe321238ab45b334347bdce874a1d2ebcd
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  7 02:51:55 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Feb  7 02:51:55 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=df1d19fe

sys-libs/glibc: drop obsolete CVS arg in 2.35/9999

See upstream commit [0].

[0] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=92963737c4376bcfd65235d5c325fa7f48302f89
Closes: https://bugs.gentoo.org/828864
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35.ebuild | 2 --
 sys-libs/glibc/glibc-9999.ebuild | 2 --
 2 files changed, 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.35.ebuild b/sys-libs/glibc/glibc-2.35.ebuild
index 39ebc6f3a02b..a7b8b1ab6527 100644
--- a/sys-libs/glibc/glibc-2.35.ebuild
+++ b/sys-libs/glibc/glibc-2.35.ebuild
@@ -950,7 +950,6 @@ glibc_do_configure() {
 	fi
 
 	myconf+=(
-		--without-cvs
 		--disable-werror
 		--enable-bind-now
 		--build=${CBUILD_OPT:-${CBUILD}}
@@ -1121,7 +1120,6 @@ glibc_headers_configure() {
 	myconf+=(
 		--disable-sanity-checks
 		--enable-hacker-mode
-		--without-cvs
 		--disable-werror
 		--enable-bind-now
 		--build=${CBUILD_OPT:-${CBUILD}}

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 39ebc6f3a02b..a7b8b1ab6527 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -950,7 +950,6 @@ glibc_do_configure() {
 	fi
 
 	myconf+=(
-		--without-cvs
 		--disable-werror
 		--enable-bind-now
 		--build=${CBUILD_OPT:-${CBUILD}}
@@ -1121,7 +1120,6 @@ glibc_headers_configure() {
 	myconf+=(
 		--disable-sanity-checks
 		--enable-hacker-mode
-		--without-cvs
 		--disable-werror
 		--enable-bind-now
 		--build=${CBUILD_OPT:-${CBUILD}}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-11  0:33 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-02-11  0:33 UTC (permalink / raw
  To: gentoo-commits

commit:     8f5a53f0508674421e39b19b25ee6d88d6fa0390
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 11 00:32:58 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Feb 11 00:33:38 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8f5a53f0

sys-libs/glibc: Remove old

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    2 -
 sys-libs/glibc/glibc-2.33-r12.ebuild | 1596 ---------------------------------
 sys-libs/glibc/glibc-2.34-r7.ebuild  | 1616 ----------------------------------
 3 files changed, 3214 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 06ef132b1520..f7266d53eea3 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -11,11 +11,9 @@ DIST glibc-2.31-patches-9.tar.xz 74712 BLAKE2B 62991b67de4def4cca944e8420d2f0139
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a65f06b22fc5a04aa631b76b3016842365006399715531ee693f3519720edcebef7884247f2f8c19e3518c1ddafab7cc SHA512 5240bc3a6df46d12c03ea4ce7b1a0df85301256ae3bd003fd04c61dadaaec34998873bf20544d891f6eedf896302bb916010aebc1d8d646a3cce09a93b533d0b
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
-DIST glibc-2.33-patches-10.tar.xz 138468 BLAKE2B a0d3acf56d6ba56a86bc0cc57e7459651488e3484a22eae82a19d746df55fbd9408a2a8be725f5dddaee50dd8bf3306226123eefd77dc6df5b5df98de3ff9ef6 SHA512 e7dd26a26b001c84ec8a1bb243437f1b9ce376aa2ed42c97ea32aa0f4e45ce234b95f260cb111e0fe1687b8cc76b86c2df35e44e98d60d2a1b327298697b021b
 DIST glibc-2.33-patches-11.tar.xz 143916 BLAKE2B ac13b3ccf9681bb6d3c35ecc33e268ea3f67c1809f916019e692dc83e3ce809402a45548da5ca6c7c30d2a45a2638f9fa4254c0355bd4c53bdb216f17aa4e28b SHA512 0ee1dfcf9574543d49ab4fbfe53571258422b6e82b9d12a33e411cee7e517821a4c45c24962b5120783a4efc898afdfa170d33486cc74d94c526bdd14cc84300
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
-DIST glibc-2.34-patches-12.tar.xz 114620 BLAKE2B 46df412e1c20cd2a42115d89a6fd4e25715fcd4e8cd6adda2dfdf384374d1e778b28168e2a4989f06abcfdcd0eec0f096472b198ed51c0b370bec950c44e0867 SHA512 0f9161caec297450cb403208980e9f62f9b29008b04f300f67c99fa37741f169f09d9886a896e1e95ad90a0ede91646150942aadf2724454987c7b3c921432e1
 DIST glibc-2.34-patches-13.tar.xz 135104 BLAKE2B 91fd2fecba36f558bb88025d3ce130b0df349c72284e999a9f65e6712e18eaaf53649a6e400194a47c55d144c22b55b42e8f313189fd2e124fef6b8ec8b1cb6d SHA512 1037d59352f0087fb6601aaf6972a92626d1d5e58b904b72d970903736efe2b93d5537e176ad3b65da322eace91a9d868dddb8d06c2396a23472117f1983b557
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-2.35-patches-1.tar.xz 19808 BLAKE2B 4128f2c58a4a0550bdfcafb955b480aa8cbcf605930e1ef537ddcda3c1dc052e7a2760d5844bb00a318576cb0d2ea374c6a9da90c902d93852357f23d440379b SHA512 5107dd0c0cea6ef645c20a9feff8be30787304afda092074985756d5033e66534adf1336f89d8a6f4390ede3fcdd8b1270ef0c6783811a9be43e0ff50d639a76

diff --git a/sys-libs/glibc/glibc-2.33-r12.ebuild b/sys-libs/glibc/glibc-2.33-r12.ebuild
deleted file mode 100644
index 1200b7f4a1c3..000000000000
--- a/sys-libs/glibc/glibc-2.33-r12.ebuild
+++ /dev/null
@@ -1,1596 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
-# on upgrades as people migrate to libxcrypt.
-# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
-PYTHON_COMPAT=( python3_{7,8,9} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-LOCALE_GEN_VER=2.22
-
-GLIBC_SYSTEMD_VER=20210814
-
-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 systemd systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-1.3.1
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-1.3.1
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	filter-flags '-fstack-protector*'
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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.
-
-		local current_binutils_path=$(binutils-config -B)
-		local current_gcc_path=$(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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; then
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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."
-				break
-			fi
-		done
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.34-r7.ebuild b/sys-libs/glibc/glibc-2.34-r7.ebuild
deleted file mode 100644
index 924a5a143215..000000000000
--- a/sys-libs/glibc/glibc-2.34-r7.ebuild
+++ /dev/null
@@ -1,1616 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
-# on upgrades as people migrate to libxcrypt.
-# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
-PYTHON_COMPAT=( python3_{7,8,9} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=12
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 +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
-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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			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)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	filter-flags '-fstack-protector*'
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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.
-
-		local current_binutils_path=$(binutils-config -B)
-		local current_gcc_path=$(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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; then
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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."
-				break
-			fi
-		done
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	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
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-11 22:44 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-02-11 22:44 UTC (permalink / raw
  To: gentoo-commits

commit:     32076822edf6e07e89e19f1e67240e06e72e65b3
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 11 22:42:48 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Feb 11 22:44:17 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=32076822

sys-libs/glibc: 2.35 patchset bump

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-2.35.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index f7266d53eea3..33dc7ca487cd 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,7 +16,7 @@ DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf00
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-13.tar.xz 135104 BLAKE2B 91fd2fecba36f558bb88025d3ce130b0df349c72284e999a9f65e6712e18eaaf53649a6e400194a47c55d144c22b55b42e8f313189fd2e124fef6b8ec8b1cb6d SHA512 1037d59352f0087fb6601aaf6972a92626d1d5e58b904b72d970903736efe2b93d5537e176ad3b65da322eace91a9d868dddb8d06c2396a23472117f1983b557
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
-DIST glibc-2.35-patches-1.tar.xz 19808 BLAKE2B 4128f2c58a4a0550bdfcafb955b480aa8cbcf605930e1ef537ddcda3c1dc052e7a2760d5844bb00a318576cb0d2ea374c6a9da90c902d93852357f23d440379b SHA512 5107dd0c0cea6ef645c20a9feff8be30787304afda092074985756d5033e66534adf1336f89d8a6f4390ede3fcdd8b1270ef0c6783811a9be43e0ff50d639a76
+DIST glibc-2.35-patches-2.tar.xz 22864 BLAKE2B eeba106b90d67fb8837be613ac2ca835ccfaabead38bcfa0408838dab2098c0259d620cb70af953714df6939fd74ccc44fb7ddc6b93172df61f9a5bb7f38356b SHA512 9f1dad92303920ec3fe28129a98a318f79e8645f236485510ce743b6f268c39c739a4d400a44753599723abb06ce01f723fd6b3dd7467dcffdf316e5ba1b773e
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.35.ebuild b/sys-libs/glibc/glibc-2.35.ebuild
index a7b8b1ab6527..0d5ef8dcb701 100644
--- a/sys-libs/glibc/glibc-2.35.ebuild
+++ b/sys-libs/glibc/glibc-2.35.ebuild
@@ -23,7 +23,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=1
+PATCH_VER=2
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-12  0:06 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-02-12  0:06 UTC (permalink / raw
  To: gentoo-commits

commit:     13b9f2e5c3dcf21f45f0b38af11e3150f34293aa
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 12 00:05:39 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Feb 12 00:05:53 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=13b9f2e5

sys-libs/glibc: Drop Python-3.7; add for 2.35 and later Python-3.10

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r13.ebuild | 2 +-
 sys-libs/glibc/glibc-2.34-r8.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.35.ebuild     | 5 +----
 sys-libs/glibc/glibc-9999.ebuild     | 5 +----
 4 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33-r13.ebuild b/sys-libs/glibc/glibc-2.33-r13.ebuild
index 7e490a4e0ccc..b17ad944d53c 100644
--- a/sys-libs/glibc/glibc-2.33-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r13.ebuild
@@ -9,7 +9,7 @@ EAPI=7
 # We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
 # on upgrades as people migrate to libxcrypt.
 # https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
-PYTHON_COMPAT=( python3_{7,8,9} )
+PYTHON_COMPAT=( python3_{8,9} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \

diff --git a/sys-libs/glibc/glibc-2.34-r8.ebuild b/sys-libs/glibc/glibc-2.34-r8.ebuild
index fd1d4147fd8a..9f369f0f3e12 100644
--- a/sys-libs/glibc/glibc-2.34-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r8.ebuild
@@ -9,7 +9,7 @@ EAPI=7
 # We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
 # on upgrades as people migrate to libxcrypt.
 # https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
-PYTHON_COMPAT=( python3_{7,8,9} )
+PYTHON_COMPAT=( python3_{8,9} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \

diff --git a/sys-libs/glibc/glibc-2.35.ebuild b/sys-libs/glibc/glibc-2.35.ebuild
index 0d5ef8dcb701..8d390c404c5b 100644
--- a/sys-libs/glibc/glibc-2.35.ebuild
+++ b/sys-libs/glibc/glibc-2.35.ebuild
@@ -6,10 +6,7 @@ EAPI=7
 # Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
 # Please read & adapt the page as necessary if obsolete.
 
-# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
-# on upgrades as people migrate to libxcrypt.
-# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
-PYTHON_COMPAT=( python3_{7,8,9} )
+PYTHON_COMPAT=( python3_{8,9,10} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a7b8b1ab6527..763643518ec1 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -6,10 +6,7 @@ EAPI=7
 # Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
 # Please read & adapt the page as necessary if obsolete.
 
-# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
-# on upgrades as people migrate to libxcrypt.
-# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
-PYTHON_COMPAT=( python3_{7,8,9} )
+PYTHON_COMPAT=( python3_{8,9,10} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-21 22:38 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-02-21 22:38 UTC (permalink / raw
  To: gentoo-commits

commit:     ee1c9d5937f531c4ae0804e1b3d39968d6ebeeec
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 21 22:38:03 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Feb 21 22:38:25 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee1c9d59

sys-libs/glibc: 2.34 patchset bump

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.34-r9.ebuild | 1616 +++++++++++++++++++++++++++++++++++
 2 files changed, 1617 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 33dc7ca487cd..a1a968171122 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,6 +15,7 @@ DIST glibc-2.33-patches-11.tar.xz 143916 BLAKE2B ac13b3ccf9681bb6d3c35ecc33e268e
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-13.tar.xz 135104 BLAKE2B 91fd2fecba36f558bb88025d3ce130b0df349c72284e999a9f65e6712e18eaaf53649a6e400194a47c55d144c22b55b42e8f313189fd2e124fef6b8ec8b1cb6d SHA512 1037d59352f0087fb6601aaf6972a92626d1d5e58b904b72d970903736efe2b93d5537e176ad3b65da322eace91a9d868dddb8d06c2396a23472117f1983b557
+DIST glibc-2.34-patches-14.tar.xz 139608 BLAKE2B 4560fd35209c5062ba28062d413ae2b2e7134918b71c9b6a1fe14392aecdac1261981627ca6862c7c7c60490f0df178c8b5650c5b3c2b5a96baf6d6e2ce1892f SHA512 e924b704234489ba7d04794f3260b3af27ae6703db38ed7832db9a90d0d1f48beab30392642ac9c88cf9010d024019db25600805c0746a50d81e612c8d09b422
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-2.35-patches-2.tar.xz 22864 BLAKE2B eeba106b90d67fb8837be613ac2ca835ccfaabead38bcfa0408838dab2098c0259d620cb70af953714df6939fd74ccc44fb7ddc6b93172df61f9a5bb7f38356b SHA512 9f1dad92303920ec3fe28129a98a318f79e8645f236485510ce743b6f268c39c739a4d400a44753599723abb06ce01f723fd6b3dd7467dcffdf316e5ba1b773e
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66

diff --git a/sys-libs/glibc/glibc-2.34-r9.ebuild b/sys-libs/glibc/glibc-2.34-r9.ebuild
new file mode 100644
index 000000000000..50bf9e2320c6
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.34-r9.ebuild
@@ -0,0 +1,1616 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
+# 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
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=14
+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"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 +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
+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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			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)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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.
+
+		local current_binutils_path=$(binutils-config -B)
+		local current_gcc_path=$(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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; then
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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."
+				break
+			fi
+		done
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-21 23:30 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-02-21 23:30 UTC (permalink / raw
  To: gentoo-commits

commit:     9ed92d6f2f713ee2a1f7bf8204a9ffc0d335990c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 21 23:29:35 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Feb 21 23:30:05 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9ed92d6f

sys-libs/glibc: 2.35 patchset bump

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-2.35.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index a1a968171122..afdc857028f2 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,7 +17,7 @@ DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d91116
 DIST glibc-2.34-patches-13.tar.xz 135104 BLAKE2B 91fd2fecba36f558bb88025d3ce130b0df349c72284e999a9f65e6712e18eaaf53649a6e400194a47c55d144c22b55b42e8f313189fd2e124fef6b8ec8b1cb6d SHA512 1037d59352f0087fb6601aaf6972a92626d1d5e58b904b72d970903736efe2b93d5537e176ad3b65da322eace91a9d868dddb8d06c2396a23472117f1983b557
 DIST glibc-2.34-patches-14.tar.xz 139608 BLAKE2B 4560fd35209c5062ba28062d413ae2b2e7134918b71c9b6a1fe14392aecdac1261981627ca6862c7c7c60490f0df178c8b5650c5b3c2b5a96baf6d6e2ce1892f SHA512 e924b704234489ba7d04794f3260b3af27ae6703db38ed7832db9a90d0d1f48beab30392642ac9c88cf9010d024019db25600805c0746a50d81e612c8d09b422
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
-DIST glibc-2.35-patches-2.tar.xz 22864 BLAKE2B eeba106b90d67fb8837be613ac2ca835ccfaabead38bcfa0408838dab2098c0259d620cb70af953714df6939fd74ccc44fb7ddc6b93172df61f9a5bb7f38356b SHA512 9f1dad92303920ec3fe28129a98a318f79e8645f236485510ce743b6f268c39c739a4d400a44753599723abb06ce01f723fd6b3dd7467dcffdf316e5ba1b773e
+DIST glibc-2.35-patches-3.tar.xz 29992 BLAKE2B aaf615d7cd2c2a00b47f3470ce92c080ffd0e7d768bf724d7e3a9ea50f161a550d9ff3c3c0734e3b00afec67d471aa04b74e050b738bf6e669720a646dab89cb SHA512 203726f333fe1d1db41c81c46cf997bdbe02409a38c4e9f8e9274512d121ad1f9412391828af8b129879e9104c58ca0a1b6f7427abfc32a161f33bd48fa44179
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.35.ebuild b/sys-libs/glibc/glibc-2.35.ebuild
index 8d390c404c5b..ca6497263fb6 100644
--- a/sys-libs/glibc/glibc-2.35.ebuild
+++ b/sys-libs/glibc/glibc-2.35.ebuild
@@ -20,7 +20,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=2
+PATCH_VER=3
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-23  0:15 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-02-23  0:15 UTC (permalink / raw
  To: gentoo-commits

commit:     a40a8c3cc89da71206d804c5c57139bb5a0897c1
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 23 00:14:44 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Feb 23 00:15:13 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a40a8c3c

sys-libs/glibc: Rekeyword 2.34-r9; reenable two tests

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r9.ebuild | 10 +---------
 sys-libs/glibc/glibc-2.35.ebuild    |  8 --------
 sys-libs/glibc/glibc-9999.ebuild    |  8 --------
 3 files changed, 1 insertion(+), 25 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.34-r9.ebuild b/sys-libs/glibc/glibc-2.34-r9.ebuild
index 50bf9e2320c6..eb9c72edf011 100644
--- a/sys-libs/glibc/glibc-2.34-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r9.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi
@@ -169,19 +169,11 @@ 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

diff --git a/sys-libs/glibc/glibc-2.35.ebuild b/sys-libs/glibc/glibc-2.35.ebuild
index ca6497263fb6..b37bf4d692ac 100644
--- a/sys-libs/glibc/glibc-2.35.ebuild
+++ b/sys-libs/glibc/glibc-2.35.ebuild
@@ -167,19 +167,11 @@ 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

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 763643518ec1..6928c0dc4788 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -167,19 +167,11 @@ 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


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-02-23 20:00 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-02-23 20:00 UTC (permalink / raw
  To: gentoo-commits

commit:     77b3502d21cfc0bd4ef6eba2d913a39f85d54e05
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 23 20:00:11 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Wed Feb 23 20:00:11 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=77b3502d

sys-libs/glibc: Stabilize 2.33-r13 hppa, #833811

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r13.ebuild b/sys-libs/glibc/glibc-2.33-r13.ebuild
index b17ad944d53c..19201d16facd 100644
--- a/sys-libs/glibc/glibc-2.33-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r13.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-06  9:46 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-03-06  9:46 UTC (permalink / raw
  To: gentoo-commits

commit:     30ca59a649cfa629781dec5f2d4a22ce3139b4ce
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  6 09:45:43 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Mar  6 09:45:43 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=30ca59a6

sys-libs/glibc: Stabilize 2.33-r13 arm, #833811

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r13.ebuild b/sys-libs/glibc/glibc-2.33-r13.ebuild
index 16e0dd297d78..e36db8a12a6d 100644
--- a/sys-libs/glibc/glibc-2.33-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r13.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-06  9:46 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-03-06  9:46 UTC (permalink / raw
  To: gentoo-commits

commit:     cfe57ff80b358f9a4a697dc9c862affca119c4a5
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  6 09:45:35 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Mar  6 09:45:35 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cfe57ff8

sys-libs/glibc: Stabilize 2.33-r13 amd64, #833811

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r13.ebuild b/sys-libs/glibc/glibc-2.33-r13.ebuild
index 19201d16facd..d18e6e2677a7 100644
--- a/sys-libs/glibc/glibc-2.33-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r13.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-06  9:46 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-03-06  9:46 UTC (permalink / raw
  To: gentoo-commits

commit:     da8e45ce1b01845418b26522a0638e416dbd0a34
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  6 09:45:39 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Mar  6 09:45:39 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=da8e45ce

sys-libs/glibc: Stabilize 2.33-r13 arm64, #833811

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r13.ebuild b/sys-libs/glibc/glibc-2.33-r13.ebuild
index d18e6e2677a7..16e0dd297d78 100644
--- a/sys-libs/glibc/glibc-2.33-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r13.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-07  1:09 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-03-07  1:09 UTC (permalink / raw
  To: gentoo-commits

commit:     b6282b2130ca0da42b871dd9f30869236faed76f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  7 01:08:58 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Mar  7 01:09:44 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b6282b21

sys-libs/glibc: Remove old

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.34-r8.ebuild | 1616 -----------------------------------
 2 files changed, 1617 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 10106d368574..bba1b3346bf6 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,7 +14,6 @@ DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6
 DIST glibc-2.33-patches-11.tar.xz 143916 BLAKE2B ac13b3ccf9681bb6d3c35ecc33e268ea3f67c1809f916019e692dc83e3ce809402a45548da5ca6c7c30d2a45a2638f9fa4254c0355bd4c53bdb216f17aa4e28b SHA512 0ee1dfcf9574543d49ab4fbfe53571258422b6e82b9d12a33e411cee7e517821a4c45c24962b5120783a4efc898afdfa170d33486cc74d94c526bdd14cc84300
 DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
-DIST glibc-2.34-patches-13.tar.xz 135104 BLAKE2B 91fd2fecba36f558bb88025d3ce130b0df349c72284e999a9f65e6712e18eaaf53649a6e400194a47c55d144c22b55b42e8f313189fd2e124fef6b8ec8b1cb6d SHA512 1037d59352f0087fb6601aaf6972a92626d1d5e58b904b72d970903736efe2b93d5537e176ad3b65da322eace91a9d868dddb8d06c2396a23472117f1983b557
 DIST glibc-2.34-patches-14.tar.xz 139608 BLAKE2B 4560fd35209c5062ba28062d413ae2b2e7134918b71c9b6a1fe14392aecdac1261981627ca6862c7c7c60490f0df178c8b5650c5b3c2b5a96baf6d6e2ce1892f SHA512 e924b704234489ba7d04794f3260b3af27ae6703db38ed7832db9a90d0d1f48beab30392642ac9c88cf9010d024019db25600805c0746a50d81e612c8d09b422
 DIST glibc-2.34-patches-15.tar.xz 146124 BLAKE2B f679f0fc27780173875178537cf996cbfb59bb844566388df0c351dec125eb02070571d4e2852742b43933d09c7a148a39bbc7b2b71fffebd7b8d9d3c16850ac SHA512 5224613e2288fcf027be224001306a84019ebe741114ee1b09d3de9b269dad0280a6dc4d88f4bc38dace501b2944a0098972589a1560756cb3da7e1b7341d672
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624

diff --git a/sys-libs/glibc/glibc-2.34-r8.ebuild b/sys-libs/glibc/glibc-2.34-r8.ebuild
deleted file mode 100644
index 9f369f0f3e12..000000000000
--- a/sys-libs/glibc/glibc-2.34-r8.ebuild
+++ /dev/null
@@ -1,1616 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
-# 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
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=13
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 +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
-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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			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)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	filter-flags '-fstack-protector*'
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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.
-
-		local current_binutils_path=$(binutils-config -B)
-		local current_gcc_path=$(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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; then
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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."
-				break
-			fi
-		done
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	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
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-07  1:09 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-03-07  1:09 UTC (permalink / raw
  To: gentoo-commits

commit:     584fb60cbb01c3915560369f5f87506531d50089
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  7 01:08:26 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Mar  7 01:09:41 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=584fb60c

sys-libs/glibc: 2.34 patchset bump

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    1 +
 sys-libs/glibc/glibc-2.34-r10.ebuild | 1608 ++++++++++++++++++++++++++++++++++
 2 files changed, 1609 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index afdc857028f2..10106d368574 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,6 +16,7 @@ DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf00
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-13.tar.xz 135104 BLAKE2B 91fd2fecba36f558bb88025d3ce130b0df349c72284e999a9f65e6712e18eaaf53649a6e400194a47c55d144c22b55b42e8f313189fd2e124fef6b8ec8b1cb6d SHA512 1037d59352f0087fb6601aaf6972a92626d1d5e58b904b72d970903736efe2b93d5537e176ad3b65da322eace91a9d868dddb8d06c2396a23472117f1983b557
 DIST glibc-2.34-patches-14.tar.xz 139608 BLAKE2B 4560fd35209c5062ba28062d413ae2b2e7134918b71c9b6a1fe14392aecdac1261981627ca6862c7c7c60490f0df178c8b5650c5b3c2b5a96baf6d6e2ce1892f SHA512 e924b704234489ba7d04794f3260b3af27ae6703db38ed7832db9a90d0d1f48beab30392642ac9c88cf9010d024019db25600805c0746a50d81e612c8d09b422
+DIST glibc-2.34-patches-15.tar.xz 146124 BLAKE2B f679f0fc27780173875178537cf996cbfb59bb844566388df0c351dec125eb02070571d4e2852742b43933d09c7a148a39bbc7b2b71fffebd7b8d9d3c16850ac SHA512 5224613e2288fcf027be224001306a84019ebe741114ee1b09d3de9b269dad0280a6dc4d88f4bc38dace501b2944a0098972589a1560756cb3da7e1b7341d672
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-2.35-patches-3.tar.xz 29992 BLAKE2B aaf615d7cd2c2a00b47f3470ce92c080ffd0e7d768bf724d7e3a9ea50f161a550d9ff3c3c0734e3b00afec67d471aa04b74e050b738bf6e669720a646dab89cb SHA512 203726f333fe1d1db41c81c46cf997bdbe02409a38c4e9f8e9274512d121ad1f9412391828af8b129879e9104c58ca0a1b6f7427abfc32a161f33bd48fa44179
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66

diff --git a/sys-libs/glibc/glibc-2.34-r10.ebuild b/sys-libs/glibc/glibc-2.34-r10.ebuild
new file mode 100644
index 000000000000..63855d2f9fda
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.34-r10.ebuild
@@ -0,0 +1,1608 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
+# 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
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=15
+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"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 +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
+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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			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)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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.
+
+		local current_binutils_path=$(binutils-config -B)
+		local current_gcc_path=$(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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; then
+		if [[ ${CTARGET} == *-linux* ]] ; then
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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."
+				break
+			fi
+		done
+	fi
+}
+
+#
+# the phases
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-08 14:57 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-03-08 14:57 UTC (permalink / raw
  To: gentoo-commits

commit:     217e36344d72a0d6608743603072448f933e2404
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Mar  8 14:57:03 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Mar  8 14:57:28 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=217e3634

sys-libs/glibc: Re-keyword 2.34-r10

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r10.ebuild b/sys-libs/glibc/glibc-2.34-r10.ebuild
index 63855d2f9fda..5c7b4c9a1936 100644
--- a/sys-libs/glibc/glibc-2.34-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r10.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-20 21:14 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-03-20 21:14 UTC (permalink / raw
  To: gentoo-commits

commit:     b522ecb1078aad753b3970d91699053974440e2f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 20 21:13:16 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Mar 20 21:13:16 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b522ecb1

sys-libs/glibc: add safety check for /usr/lib/include

This directory isn't used by anything legitimate but
it breaks the build in a confusing way.

Add a check for it & bail out if it exists.

If you do have this directory on your system,
back up its contents, then move it away/delete it.

Closes: https://bugs.gentoo.org/643302
Closes: https://bugs.gentoo.org/833620
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r10.ebuild | 8 ++++++++
 sys-libs/glibc/glibc-2.35.ebuild     | 8 ++++++++
 sys-libs/glibc/glibc-9999.ebuild     | 8 ++++++++
 3 files changed, 24 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.34-r10.ebuild b/sys-libs/glibc/glibc-2.34-r10.ebuild
index 4dea22b5ab39..2ec1d7e98e09 100644
--- a/sys-libs/glibc/glibc-2.34-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r10.ebuild
@@ -760,6 +760,14 @@ sanity_prechecks() {
 
 	# When we actually have to compile something...
 	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
 			local run_kv build_kv want_kv
 

diff --git a/sys-libs/glibc/glibc-2.35.ebuild b/sys-libs/glibc/glibc-2.35.ebuild
index d656aea8f10a..430062880001 100644
--- a/sys-libs/glibc/glibc-2.35.ebuild
+++ b/sys-libs/glibc/glibc-2.35.ebuild
@@ -750,6 +750,14 @@ sanity_prechecks() {
 
 	# When we actually have to compile something...
 	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
 			local run_kv build_kv want_kv
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ffc7af277618..2a26162f17d2 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -750,6 +750,14 @@ sanity_prechecks() {
 
 	# When we actually have to compile something...
 	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
 			local run_kv build_kv want_kv
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-20 21:14 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-03-20 21:14 UTC (permalink / raw
  To: gentoo-commits

commit:     ec02fa205231d94d8e4b35e3c58c02b99313ff26
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 20 21:06:11 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Mar 20 21:06:11 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec02fa20

sys-libs/glibc: drop USE=clone3 in >= 2.34-r10

All -clone3 deps are gone now, so we always enable
clone3 in these versions and beyond.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r10.ebuild | 11 +++--------
 sys-libs/glibc/glibc-2.35.ebuild     | 11 +++--------
 sys-libs/glibc/glibc-9999.ebuild     | 11 +++--------
 3 files changed, 9 insertions(+), 24 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.34-r10.ebuild b/sys-libs/glibc/glibc-2.34-r10.ebuild
index 5c7b4c9a1936..4dea22b5ab39 100644
--- a/sys-libs/glibc/glibc-2.34-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r10.ebuild
@@ -46,7 +46,7 @@ SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${L
 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 +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"
+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"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -863,13 +863,8 @@ src_prepare() {
 		einfo "Done."
 	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
+	# TODO: We can drop this once patch is gone from our patchset
+	append-cppflags -DGENTOO_USE_CLONE3
 
 	default
 

diff --git a/sys-libs/glibc/glibc-2.35.ebuild b/sys-libs/glibc/glibc-2.35.ebuild
index b37bf4d692ac..d656aea8f10a 100644
--- a/sys-libs/glibc/glibc-2.35.ebuild
+++ b/sys-libs/glibc/glibc-2.35.ebuild
@@ -44,7 +44,7 @@ SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${L
 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 +clone3 compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +static-libs suid systemd systemtap test vanilla"
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +static-libs suid systemd systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -850,13 +850,8 @@ src_prepare() {
 		einfo "Done."
 	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
+	# TODO: We can drop this once patch is gone from our patchset
+	append-cppflags -DGENTOO_USE_CLONE3
 
 	default
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 6928c0dc4788..ffc7af277618 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -44,7 +44,7 @@ SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${L
 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 +clone3 compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +static-libs suid systemd systemtap test vanilla"
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +static-libs suid systemd systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -850,13 +850,8 @@ src_prepare() {
 		einfo "Done."
 	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
+	# TODO: We can drop this once patch is gone from our patchset
+	append-cppflags -DGENTOO_USE_CLONE3
 
 	default
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-21 23:33 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-03-21 23:33 UTC (permalink / raw
  To: gentoo-commits

commit:     dcec8c0f11216f88cba1011127e08be61b09f5dd
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 21 23:30:25 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Mar 21 23:30:25 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dcec8c0f

sys-libs/glibc: fix WhitespaceFound

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35.ebuild b/sys-libs/glibc/glibc-2.35.ebuild
index 430062880001..014bac6b2005 100644
--- a/sys-libs/glibc/glibc-2.35.ebuild
+++ b/sys-libs/glibc/glibc-2.35.ebuild
@@ -756,7 +756,7 @@ sanity_prechecks() {
 			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
+		fi
 
 		if [[ ${CTARGET} == *-linux* ]] ; then
 			local run_kv build_kv want_kv


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-22 16:58 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-03-22 16:58 UTC (permalink / raw
  To: gentoo-commits

commit:     3588625fe514077e4a0a9a6a8141f00f840eca8e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 22 11:31:41 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Mar 22 16:57:59 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3588625f

sys-libs/glibc: Improve clang override

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r10.ebuild | 6 ++++--
 sys-libs/glibc/glibc-2.35.ebuild     | 6 ++++--
 sys-libs/glibc/glibc-9999.ebuild     | 6 ++++--
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.34-r10.ebuild b/sys-libs/glibc/glibc-2.34-r10.ebuild
index 655a41a7f00c..e5b596095245 100644
--- a/sys-libs/glibc/glibc-2.34-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r10.ebuild
@@ -525,9 +525,11 @@ setup_env() {
 		# 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=$(binutils-config -B)
-		local current_gcc_path=$(gcc-config -B)
+		local current_binutils_path=$(env ROOT="${SYSROOT}" binutils-config -B)
+		local current_gcc_path=$(env ROOT="${SYSROOT}" gcc-config -B)
 		einfo "Overriding clang configuration, since it won't work here"
 
 		export CC="${current_gcc_path}/gcc"

diff --git a/sys-libs/glibc/glibc-2.35.ebuild b/sys-libs/glibc/glibc-2.35.ebuild
index 014bac6b2005..0237132b9373 100644
--- a/sys-libs/glibc/glibc-2.35.ebuild
+++ b/sys-libs/glibc/glibc-2.35.ebuild
@@ -515,9 +515,11 @@ setup_env() {
 		# 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=$(binutils-config -B)
-		local current_gcc_path=$(gcc-config -B)
+		local current_binutils_path=$(env ROOT="${SYSROOT}" binutils-config -B)
+		local current_gcc_path=$(env ROOT="${SYSROOT}" gcc-config -B)
 		einfo "Overriding clang configuration, since it won't work here"
 
 		export CC="${current_gcc_path}/gcc"

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2a26162f17d2..f9c41f6d8ccc 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -515,9 +515,11 @@ setup_env() {
 		# 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=$(binutils-config -B)
-		local current_gcc_path=$(gcc-config -B)
+		local current_binutils_path=$(env ROOT="${SYSROOT}" binutils-config -B)
+		local current_gcc_path=$(env ROOT="${SYSROOT}" gcc-config -B)
 		einfo "Overriding clang configuration, since it won't work here"
 
 		export CC="${current_gcc_path}/gcc"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-26 19:45 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-03-26 19:45 UTC (permalink / raw
  To: gentoo-commits

commit:     937195a9e80cc23e629ee0945a5d625545ac74af
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 26 19:42:36 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 26 19:42:36 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=937195a9

sys-libs/glibc: Stabilize 2.33-r13 x86, #833811

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r13.ebuild b/sys-libs/glibc/glibc-2.33-r13.ebuild
index e36db8a12a6d..88ac8b52a61c 100644
--- a/sys-libs/glibc/glibc-2.33-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r13.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-26 19:45 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-03-26 19:45 UTC (permalink / raw
  To: gentoo-commits

commit:     322d0b7ba0ad1d614b5302495344a357859c1ca6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 26 19:42:50 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 26 19:42:50 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=322d0b7b

sys-libs/glibc: Stabilize 2.33-r13 ppc, #833811

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r13.ebuild b/sys-libs/glibc/glibc-2.33-r13.ebuild
index 51911c7f0d25..e462920f483a 100644
--- a/sys-libs/glibc/glibc-2.33-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r13.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ppc ~ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-26 19:45 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-03-26 19:45 UTC (permalink / raw
  To: gentoo-commits

commit:     0c1548cb50e97947d0679e4435e8769ce7bff819
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 26 19:42:45 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 26 19:42:45 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0c1548cb

sys-libs/glibc: Stabilize 2.33-r13 sparc, #833811

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r13.ebuild b/sys-libs/glibc/glibc-2.33-r13.ebuild
index 88ac8b52a61c..51911c7f0d25 100644
--- a/sys-libs/glibc/glibc-2.33-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r13.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-26 19:45 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-03-26 19:45 UTC (permalink / raw
  To: gentoo-commits

commit:     30d597dd20f98437b55e02b45d5a46f3938027e5
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 26 19:42:55 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 26 19:42:55 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=30d597dd

sys-libs/glibc: Stabilize 2.33-r13 ppc64, #833811

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.33-r13.ebuild b/sys-libs/glibc/glibc-2.33-r13.ebuild
index e462920f483a..cf8ae91b27fa 100644
--- a/sys-libs/glibc/glibc-2.33-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r13.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-26 20:51 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-03-26 20:51 UTC (permalink / raw
  To: gentoo-commits

commit:     902f0253d40756d4e9cd16834295cc63c55c2d53
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 26 20:51:14 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Mar 26 20:51:14 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=902f0253

sys-libs/glibc: Remove old

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 -
 sys-libs/glibc/glibc-2.33-r7.ebuild | 1555 ---------------------------------
 sys-libs/glibc/glibc-2.34-r9.ebuild | 1608 -----------------------------------
 sys-libs/glibc/metadata.xml         |    1 -
 4 files changed, 3166 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index bba1b3346bf6..fba231c648b5 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -12,9 +12,7 @@ DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d
 DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a65f06b22fc5a04aa631b76b3016842365006399715531ee693f3519720edcebef7884247f2f8c19e3518c1ddafab7cc SHA512 5240bc3a6df46d12c03ea4ce7b1a0df85301256ae3bd003fd04c61dadaaec34998873bf20544d891f6eedf896302bb916010aebc1d8d646a3cce09a93b533d0b
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST glibc-2.33-patches-11.tar.xz 143916 BLAKE2B ac13b3ccf9681bb6d3c35ecc33e268ea3f67c1809f916019e692dc83e3ce809402a45548da5ca6c7c30d2a45a2638f9fa4254c0355bd4c53bdb216f17aa4e28b SHA512 0ee1dfcf9574543d49ab4fbfe53571258422b6e82b9d12a33e411cee7e517821a4c45c24962b5120783a4efc898afdfa170d33486cc74d94c526bdd14cc84300
-DIST glibc-2.33-patches-6.tar.xz 64632 BLAKE2B f04ca4320d65c8796c67471cb56d3bf002cc34fb6a81075b85948e41c94df46cb2a3a944cced42d6d2c17ffc11e32a9840810864e655cc0fe18e6e0fe9f3c985 SHA512 b95746cd3415ec9ca275e542a2b5fddd5ce5680aa3bda08e94e96cf431191f7488ef6b7999ff0dfaf7405a4212531a75283e9bd7f5ae65bf572912038877a6df
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
-DIST glibc-2.34-patches-14.tar.xz 139608 BLAKE2B 4560fd35209c5062ba28062d413ae2b2e7134918b71c9b6a1fe14392aecdac1261981627ca6862c7c7c60490f0df178c8b5650c5b3c2b5a96baf6d6e2ce1892f SHA512 e924b704234489ba7d04794f3260b3af27ae6703db38ed7832db9a90d0d1f48beab30392642ac9c88cf9010d024019db25600805c0746a50d81e612c8d09b422
 DIST glibc-2.34-patches-15.tar.xz 146124 BLAKE2B f679f0fc27780173875178537cf996cbfb59bb844566388df0c351dec125eb02070571d4e2852742b43933d09c7a148a39bbc7b2b71fffebd7b8d9d3c16850ac SHA512 5224613e2288fcf027be224001306a84019ebe741114ee1b09d3de9b269dad0280a6dc4d88f4bc38dace501b2944a0098972589a1560756cb3da7e1b7341d672
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-2.35-patches-3.tar.xz 29992 BLAKE2B aaf615d7cd2c2a00b47f3470ce92c080ffd0e7d768bf724d7e3a9ea50f161a550d9ff3c3c0734e3b00afec67d471aa04b74e050b738bf6e669720a646dab89cb SHA512 203726f333fe1d1db41c81c46cf997bdbe02409a38c4e9f8e9274512d121ad1f9412391828af8b129879e9104c58ca0a1b6f7427abfc32a161f33bd48fa44179

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild b/sys-libs/glibc/glibc-2.33-r7.ebuild
deleted file mode 100644
index 9c12fe15458e..000000000000
--- a/sys-libs/glibc/glibc-2.33-r7.ebuild
+++ /dev/null
@@ -1,1555 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
-# on upgrades as people migrate to libxcrypt.
-# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
-PYTHON_COMPAT=( python3_{7,8,9} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=6
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-LOCALE_GEN_VER=2.10
-
-GLIBC_SYSTEMD_VER=20210814
-
-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 systemd systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-1.3.1
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-1.3.1
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; 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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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
-		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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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."
-		elog "If you have FEATURES=collision-protect, please use FEATURES=unmerge-orphans instead!"
-	fi
-}

diff --git a/sys-libs/glibc/glibc-2.34-r9.ebuild b/sys-libs/glibc/glibc-2.34-r9.ebuild
deleted file mode 100644
index eb9c72edf011..000000000000
--- a/sys-libs/glibc/glibc-2.34-r9.ebuild
+++ /dev/null
@@ -1,1608 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
-# 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
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=14
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 +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
-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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			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)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	filter-flags '-fstack-protector*'
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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.
-
-		local current_binutils_path=$(binutils-config -B)
-		local current_gcc_path=$(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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; then
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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."
-				break
-			fi
-		done
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	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
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index 613e58eff7ee..a87c547c6a07 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -7,7 +7,6 @@
 </maintainer>
 <use>
  <flag name="cet">Enable Intel Control-flow Enforcement Technology (needs binutils 2.29 and gcc 8)</flag>
- <flag name="clone3">Enable the new clone3 syscall within glibc. Can be disabled to allow compatibility with older Electron applications.</flag>
  <flag name="compile-locales">build *all* locales in src_install; this is generally meant for stage building only as it ignores /etc/locale.gen file and can be pretty slow</flag>
  <flag name="crypt">build and install libcrypt and crypt.h</flag>
  <flag name="debug">When USE=hardened, allow fortify/stack violations to dump core (SIGABRT) and not kill self (SIGKILL)</flag>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-26 21:40 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-03-26 21:40 UTC (permalink / raw
  To: gentoo-commits

commit:     d8dc11564e748eef9325d87bf5c396229cedc802
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 26 21:40:38 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 26 21:40:38 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d8dc1156

sys-libs/glibc: Stabilize 2.34-r10 sparc, #833191

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r10.ebuild b/sys-libs/glibc/glibc-2.34-r10.ebuild
index e5b596095245..f22c0e59c010 100644
--- a/sys-libs/glibc/glibc-2.34-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r10.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-26 21:40 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-03-26 21:40 UTC (permalink / raw
  To: gentoo-commits

commit:     fad2a26f870c254c9bde7ceee306cba855ad88e7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 26 21:40:43 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 26 21:40:43 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fad2a26f

sys-libs/glibc: Stabilize 2.34-r10 amd64, #833191

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r10.ebuild b/sys-libs/glibc/glibc-2.34-r10.ebuild
index f22c0e59c010..a21b043589eb 100644
--- a/sys-libs/glibc/glibc-2.34-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r10.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-27 14:06 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-03-27 14:06 UTC (permalink / raw
  To: gentoo-commits

commit:     a25a710d9ccd4aa4f5a08cb035aab797913607c0
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 27 14:05:35 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Mar 27 14:06:10 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a25a710d

sys-libs/glibc: Build binaries are BROOT not SYSROOT

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35.ebuild | 4 ++--
 sys-libs/glibc/glibc-9999.ebuild | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.35.ebuild b/sys-libs/glibc/glibc-2.35.ebuild
index 0237132b9373..c02fa282882f 100644
--- a/sys-libs/glibc/glibc-2.35.ebuild
+++ b/sys-libs/glibc/glibc-2.35.ebuild
@@ -518,8 +518,8 @@ setup_env() {
 		# Last, we need the settings of the *build* environment, not of the
 		# target environment...
 
-		local current_binutils_path=$(env ROOT="${SYSROOT}" binutils-config -B)
-		local current_gcc_path=$(env ROOT="${SYSROOT}" gcc-config -B)
+		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"

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f9c41f6d8ccc..9ba451c12e1a 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -518,8 +518,8 @@ setup_env() {
 		# Last, we need the settings of the *build* environment, not of the
 		# target environment...
 
-		local current_binutils_path=$(env ROOT="${SYSROOT}" binutils-config -B)
-		local current_gcc_path=$(env ROOT="${SYSROOT}" gcc-config -B)
+		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"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-27 16:09 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-03-27 16:09 UTC (permalink / raw
  To: gentoo-commits

commit:     a7eef27f85664b50496c936d0b782592abb0fbdb
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 27 16:08:45 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Mar 27 16:09:01 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a7eef27f

sys-libs/glibc: 2.35 patchlevel bump

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest                                    | 2 +-
 sys-libs/glibc/{glibc-2.35.ebuild => glibc-2.35-r1.ebuild} | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index fba231c648b5..6302f98807af 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,7 +15,7 @@ DIST glibc-2.33-patches-11.tar.xz 143916 BLAKE2B ac13b3ccf9681bb6d3c35ecc33e268e
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-15.tar.xz 146124 BLAKE2B f679f0fc27780173875178537cf996cbfb59bb844566388df0c351dec125eb02070571d4e2852742b43933d09c7a148a39bbc7b2b71fffebd7b8d9d3c16850ac SHA512 5224613e2288fcf027be224001306a84019ebe741114ee1b09d3de9b269dad0280a6dc4d88f4bc38dace501b2944a0098972589a1560756cb3da7e1b7341d672
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
-DIST glibc-2.35-patches-3.tar.xz 29992 BLAKE2B aaf615d7cd2c2a00b47f3470ce92c080ffd0e7d768bf724d7e3a9ea50f161a550d9ff3c3c0734e3b00afec67d471aa04b74e050b738bf6e669720a646dab89cb SHA512 203726f333fe1d1db41c81c46cf997bdbe02409a38c4e9f8e9274512d121ad1f9412391828af8b129879e9104c58ca0a1b6f7427abfc32a161f33bd48fa44179
+DIST glibc-2.35-patches-4.tar.xz 45456 BLAKE2B 47e1c5e4db4969da27f14816ac9b856f3a57e152139e071f0fd0ecf53b7ac2a0372a8dec7e9e51808d463d2e5b12a6acc9145bb0127a7f36cf1d19b96a0efa41 SHA512 39ca84ed5f3e74bccb8875a77188bb16f6b45b1b22843b4ccf8a7f792d35e05e8305929fbeede290ebb128722caf8277da03dbf4aee9261940765f8dfcd01561
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.35.ebuild b/sys-libs/glibc/glibc-2.35-r1.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.35.ebuild
rename to sys-libs/glibc/glibc-2.35-r1.ebuild
index c02fa282882f..8caa9d18c50c 100644
--- a/sys-libs/glibc/glibc-2.35.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r1.ebuild
@@ -20,7 +20,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=3
+PATCH_VER=4
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-27 16:14 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-03-27 16:14 UTC (permalink / raw
  To: gentoo-commits

commit:     8b1bbe94cd600577da9179cb3a0c398ea26d068b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 27 16:14:29 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Mar 27 16:14:29 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8b1bbe94

sys-libs/glibc: clone3 patch is reverted/gone for 2.35 and master

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r1.ebuild | 3 ---
 sys-libs/glibc/glibc-9999.ebuild    | 3 ---
 2 files changed, 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.35-r1.ebuild b/sys-libs/glibc/glibc-2.35-r1.ebuild
index 8caa9d18c50c..9d9a70b14c3b 100644
--- a/sys-libs/glibc/glibc-2.35-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r1.ebuild
@@ -860,9 +860,6 @@ src_prepare() {
 		einfo "Done."
 	fi
 
-	# TODO: We can drop this once patch is gone from our patchset
-	append-cppflags -DGENTOO_USE_CLONE3
-
 	default
 
 	gnuconfig_update

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 9ba451c12e1a..29d4afe1ab2b 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -860,9 +860,6 @@ src_prepare() {
 		einfo "Done."
 	fi
 
-	# TODO: We can drop this once patch is gone from our patchset
-	append-cppflags -DGENTOO_USE_CLONE3
-
 	default
 
 	gnuconfig_update


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-27 17:06 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-03-27 17:06 UTC (permalink / raw
  To: gentoo-commits

commit:     2ed74d090e77abb80081d69b671d73bc58bd5d94
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 27 17:06:10 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Mar 27 17:06:10 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2ed74d09

sys-libs/glibc: Stabilize 2.34-r10 x86, #833191

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r10.ebuild b/sys-libs/glibc/glibc-2.34-r10.ebuild
index a21b043589eb..8150f4574f2a 100644
--- a/sys-libs/glibc/glibc-2.34-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r10.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-27 20:30 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-03-27 20:30 UTC (permalink / raw
  To: gentoo-commits

commit:     0190858f5462cb08962bcfb0520ebe8e029ad378
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 27 20:30:05 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Mar 27 20:30:20 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0190858f

sys-libs/glibc: Rekeyword 2.35-r1

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r1.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.35-r1.ebuild b/sys-libs/glibc/glibc-2.35-r1.ebuild
index 9d9a70b14c3b..0edba3776234 100644
--- a/sys-libs/glibc/glibc-2.35-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r1.ebuild
@@ -26,8 +26,7 @@ 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=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-27 23:26 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-03-27 23:26 UTC (permalink / raw
  To: gentoo-commits

commit:     8c649b8fc2db8abb268098ce1e139bc4b86e9ecc
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 27 23:25:28 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Mar 27 23:25:47 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c649b8f

sys-libs/glibc: add bug references to "restart processes" warning

Bug: https://bugs.gentoo.org/660556
Bug: https://bugs.gentoo.org/741116
Bug: https://bugs.gentoo.org/823756
See: https://forums.gentoo.org/viewtopic-t-1147884.html
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r10.ebuild | 1 +
 sys-libs/glibc/glibc-2.35-r1.ebuild  | 1 +
 sys-libs/glibc/glibc-9999.ebuild     | 1 +
 3 files changed, 3 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.34-r10.ebuild b/sys-libs/glibc/glibc-2.34-r10.ebuild
index 8150f4574f2a..ac93d898cf4d 100644
--- a/sys-libs/glibc/glibc-2.34-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r10.ebuild
@@ -805,6 +805,7 @@ upgrade_warning() {
 				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

diff --git a/sys-libs/glibc/glibc-2.35-r1.ebuild b/sys-libs/glibc/glibc-2.35-r1.ebuild
index 0edba3776234..891974bc21c4 100644
--- a/sys-libs/glibc/glibc-2.35-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r1.ebuild
@@ -794,6 +794,7 @@ upgrade_warning() {
 				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

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 29d4afe1ab2b..2483aefe5d6a 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -795,6 +795,7 @@ upgrade_warning() {
 				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


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-30 23:19 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-03-30 23:19 UTC (permalink / raw
  To: gentoo-commits

commit:     bfd4644d464949179a652fa6c2cbfd1fd2fd4b3e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 30 23:18:57 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Mar 30 23:19:22 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bfd4644d

sys-libs/glibc: Revbumps to reintroduce clone3 useflag

Unkeyworded until minimal testing is done

Bug: https://bugs.gentoo.org/835930
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    2 +
 sys-libs/glibc/glibc-2.34-r11.ebuild | 1619 ++++++++++++++++++++++++++++++++++
 sys-libs/glibc/glibc-2.35-r2.ebuild  | 1590 +++++++++++++++++++++++++++++++++
 sys-libs/glibc/metadata.xml          |    1 +
 4 files changed, 3212 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 6302f98807af..78eb7f5cc1e1 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,8 +14,10 @@ DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6
 DIST glibc-2.33-patches-11.tar.xz 143916 BLAKE2B ac13b3ccf9681bb6d3c35ecc33e268ea3f67c1809f916019e692dc83e3ce809402a45548da5ca6c7c30d2a45a2638f9fa4254c0355bd4c53bdb216f17aa4e28b SHA512 0ee1dfcf9574543d49ab4fbfe53571258422b6e82b9d12a33e411cee7e517821a4c45c24962b5120783a4efc898afdfa170d33486cc74d94c526bdd14cc84300
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-15.tar.xz 146124 BLAKE2B f679f0fc27780173875178537cf996cbfb59bb844566388df0c351dec125eb02070571d4e2852742b43933d09c7a148a39bbc7b2b71fffebd7b8d9d3c16850ac SHA512 5224613e2288fcf027be224001306a84019ebe741114ee1b09d3de9b269dad0280a6dc4d88f4bc38dace501b2944a0098972589a1560756cb3da7e1b7341d672
+DIST glibc-2.34-patches-16.tar.xz 164648 BLAKE2B 78786a67109812942ac11bee9a880b9383aa61d0c2b006e3e7e635218842f49c6ce5b7c75597f7d317aa18fede0ca0c79a4bd436b8659ba6a2f1953848484d2a SHA512 acfc91e821cd8b4e57907c7aeaf1eac0bae1f8e244e4011f27819a8ba16a4e9c10fc675c6aaff992be81bba9373ec981fb598838f26aa247e7bd016e2cd786d2
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-2.35-patches-4.tar.xz 45456 BLAKE2B 47e1c5e4db4969da27f14816ac9b856f3a57e152139e071f0fd0ecf53b7ac2a0372a8dec7e9e51808d463d2e5b12a6acc9145bb0127a7f36cf1d19b96a0efa41 SHA512 39ca84ed5f3e74bccb8875a77188bb16f6b45b1b22843b4ccf8a7f792d35e05e8305929fbeede290ebb128722caf8277da03dbf4aee9261940765f8dfcd01561
+DIST glibc-2.35-patches-5.tar.xz 45632 BLAKE2B b49161139e8a9e6f4351b5954f38eaa3b0b16a444c370b906e2fcac8eb25c306e6f95474063e511a4f8bf48c0eade9509a6158a1019e32ec4b95c49f992405eb SHA512 5bf20061f24ad087aa0f22808cb0dfd810e5413e71dc9b9c7ec0e9cecd172c40e3517e0a151294175351cf0e037e9c35d8b50ba391a312976e7c4103845089e4
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.34-r11.ebuild b/sys-libs/glibc/glibc-2.34-r11.ebuild
new file mode 100644
index 000000000000..20fbb221625f
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.34-r11.ebuild
@@ -0,0 +1,1619 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
+# 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
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=16
+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"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 +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
+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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			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)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}

diff --git a/sys-libs/glibc/glibc-2.35-r2.ebuild b/sys-libs/glibc/glibc-2.35-r2.ebuild
new file mode 100644
index 000000000000..78bb7d0b6e0f
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.35-r2.ebuild
@@ -0,0 +1,1590 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# 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,9,10} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=5
+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"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 +clone3 compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	echo
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index a87c547c6a07..613e58eff7ee 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -7,6 +7,7 @@
 </maintainer>
 <use>
  <flag name="cet">Enable Intel Control-flow Enforcement Technology (needs binutils 2.29 and gcc 8)</flag>
+ <flag name="clone3">Enable the new clone3 syscall within glibc. Can be disabled to allow compatibility with older Electron applications.</flag>
  <flag name="compile-locales">build *all* locales in src_install; this is generally meant for stage building only as it ignores /etc/locale.gen file and can be pretty slow</flag>
  <flag name="crypt">build and install libcrypt and crypt.h</flag>
  <flag name="debug">When USE=hardened, allow fortify/stack violations to dump core (SIGABRT) and not kill self (SIGKILL)</flag>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-31 19:02 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-03-31 19:02 UTC (permalink / raw
  To: gentoo-commits

commit:     b94b6dd30d47eaa7d5ea44c4eb990223f977bb64
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 31 19:00:52 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Mar 31 19:01:50 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b94b6dd3

sys-libs/glibc: Rekeyword 2.34-r11

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r11.ebuild b/sys-libs/glibc/glibc-2.34-r11.ebuild
index 20fbb221625f..ff5bd4304774 100644
--- a/sys-libs/glibc/glibc-2.34-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r11.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-31 20:54 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-03-31 20:54 UTC (permalink / raw
  To: gentoo-commits

commit:     1d8215bb40547400facf81f40ca0af2ad998f2d6
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 31 20:53:50 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Mar 31 20:54:05 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1d8215bb

sys-libs/glibc: Rekeyword 2.35-r2

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r2.ebuild b/sys-libs/glibc/glibc-2.35-r2.ebuild
index 78bb7d0b6e0f..6a0d35ce8ad5 100644
--- a/sys-libs/glibc/glibc-2.35-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r2.ebuild
@@ -26,7 +26,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-03-31 21:17 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-03-31 21:17 UTC (permalink / raw
  To: gentoo-commits

commit:     b4425acd78559736b7ad2b68b651a61ed6cdf550
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 31 21:17:04 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Thu Mar 31 21:17:04 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b4425acd

sys-libs/glibc: Stabilize 2.34-r10 ppc64, #833191

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r10.ebuild b/sys-libs/glibc/glibc-2.34-r10.ebuild
index ac93d898cf4d..2f1472e3f3e3 100644
--- a/sys-libs/glibc/glibc-2.34-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r10.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-04-01  6:39 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-04-01  6:39 UTC (permalink / raw
  To: gentoo-commits

commit:     6dc662561726e6cdfa2abfa255e0a5cec8617825
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  1 06:39:17 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Apr  1 06:39:17 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6dc66256

sys-libs/glibc: Stabilize 2.34-r10 arm, #833191

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r10.ebuild b/sys-libs/glibc/glibc-2.34-r10.ebuild
index 2f1472e3f3e3..9e8c060df18d 100644
--- a/sys-libs/glibc/glibc-2.34-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r10.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-04-01  9:29 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-04-01  9:29 UTC (permalink / raw
  To: gentoo-commits

commit:     a789116eb6a7e0987cfc8aced0de477f745c314b
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  1 09:29:35 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Apr  1 09:29:35 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a789116e

sys-libs/glibc: Stabilize 2.34-r10 ppc, #833191

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r10.ebuild b/sys-libs/glibc/glibc-2.34-r10.ebuild
index 9e8c060df18d..8ecfd23217fd 100644
--- a/sys-libs/glibc/glibc-2.34-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r10.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-04-02  7:33 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-04-02  7:33 UTC (permalink / raw
  To: gentoo-commits

commit:     1742a66f922ad44c45d8fb1c7876269974f03f9a
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  2 07:33:14 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Apr  2 07:33:14 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1742a66f

sys-libs/glibc: Stabilize 2.34-r10 arm64, #833191

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r10.ebuild b/sys-libs/glibc/glibc-2.34-r10.ebuild
index 8ecfd23217fd..0bc6be3e278b 100644
--- a/sys-libs/glibc/glibc-2.34-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r10.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-04-07 19:53 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-04-07 19:53 UTC (permalink / raw
  To: gentoo-commits

commit:     256df48ff6e85ffa389cc2d25453d100279b62fe
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Apr  7 19:51:59 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Apr  7 19:51:59 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=256df48f

sys-libs/glibc: filter -fcf-protection

Set USE=cet if you want this. glibc can't be built with this *everywhere*,
and the configure option (controlled by USE=cet) sets it for the components
for which it works.

It's just like SSP and PIE. You can't force it on all of glibc, and we have
mechanisms to do it properly (USE=cet).

Closes: https://bugs.gentoo.org/830454
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r11.ebuild | 3 +++
 sys-libs/glibc/glibc-2.35-r2.ebuild  | 3 +++
 sys-libs/glibc/glibc-9999.ebuild     | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.34-r11.ebuild b/sys-libs/glibc/glibc-2.34-r11.ebuild
index ff5bd4304774..3cf633bea543 100644
--- a/sys-libs/glibc/glibc-2.34-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r11.ebuild
@@ -440,6 +440,9 @@ setup_flags() {
 	replace-flags -O0 -O1
 
 	filter-flags '-fstack-protector*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
 }
 
 use_multiarch() {

diff --git a/sys-libs/glibc/glibc-2.35-r2.ebuild b/sys-libs/glibc/glibc-2.35-r2.ebuild
index 6a0d35ce8ad5..22e2d5153f19 100644
--- a/sys-libs/glibc/glibc-2.35-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r2.ebuild
@@ -429,6 +429,9 @@ setup_flags() {
 	replace-flags -O0 -O1
 
 	filter-flags '-fstack-protector*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
 }
 
 use_multiarch() {

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2483aefe5d6a..94842d8172b7 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -430,6 +430,9 @@ setup_flags() {
 	replace-flags -O0 -O1
 
 	filter-flags '-fstack-protector*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
 }
 
 use_multiarch() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-04-10 10:54 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-04-10 10:54 UTC (permalink / raw
  To: gentoo-commits

commit:     a389baf98dd67ea9b1f22acb2aa227543ff88e9d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 10 10:54:00 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Apr 10 10:54:00 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a389baf9

sys-libs/glibc: add filter-flags for CET to 2.34-r10 too

May as well add it to the stable one as lots of people seem
to be shoving this in CFLAGS in make.conf now and don't
want more dupes.

See 256df48ff6e85ffa389cc2d25453d100279b62fe for more
background.

Bug: https://bugs.gentoo.org/830454
See: 256df48ff6e85ffa389cc2d25453d100279b62fe
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r10.ebuild | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.34-r10.ebuild b/sys-libs/glibc/glibc-2.34-r10.ebuild
index 0bc6be3e278b..e607faf13339 100644
--- a/sys-libs/glibc/glibc-2.34-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r10.ebuild
@@ -440,6 +440,9 @@ setup_flags() {
 	replace-flags -O0 -O1
 
 	filter-flags '-fstack-protector*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
 }
 
 use_multiarch() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-04-19 22:09 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-04-19 22:09 UTC (permalink / raw
  To: gentoo-commits

commit:     e5afbd004d49ecaa3a05b192a8bb0c21ea9d2f0e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 19 22:08:23 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Apr 19 22:08:23 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5afbd00

sys-libs/glibc: re-enable DT_HASH

It ends up breaking applications in unexpected ways (and it's not
obvious to the user what's happening), and after speaking to upstream,
it's not really even on their agenda to remove DT_HASH right now.

Bug: https://bugs.gentoo.org/347761
Bug: https://bugs.gentoo.org/527504
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 94842d8172b7..0ccad6a681c1 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -994,11 +994,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}"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-04-20 22:25 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-04-20 22:25 UTC (permalink / raw
  To: gentoo-commits

commit:     1e9f2d420dbf8be174aef307ea10bce4739a7e8f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 20 21:42:48 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Apr 20 22:25:31 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1e9f2d42

sys-libs/glibc: 2.35 patchset bump

Mostly fixes issues with m68k and mips-n32

Bug: https://bugs.gentoo.org/837734
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29069
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29071
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.35-r3.ebuild | 1593 +++++++++++++++++++++++++++++++++++
 2 files changed, 1594 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 78eb7f5cc1e1..04a4fc9125dd 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,6 +18,7 @@ DIST glibc-2.34-patches-16.tar.xz 164648 BLAKE2B 78786a67109812942ac11bee9a880b9
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-2.35-patches-4.tar.xz 45456 BLAKE2B 47e1c5e4db4969da27f14816ac9b856f3a57e152139e071f0fd0ecf53b7ac2a0372a8dec7e9e51808d463d2e5b12a6acc9145bb0127a7f36cf1d19b96a0efa41 SHA512 39ca84ed5f3e74bccb8875a77188bb16f6b45b1b22843b4ccf8a7f792d35e05e8305929fbeede290ebb128722caf8277da03dbf4aee9261940765f8dfcd01561
 DIST glibc-2.35-patches-5.tar.xz 45632 BLAKE2B b49161139e8a9e6f4351b5954f38eaa3b0b16a444c370b906e2fcac8eb25c306e6f95474063e511a4f8bf48c0eade9509a6158a1019e32ec4b95c49f992405eb SHA512 5bf20061f24ad087aa0f22808cb0dfd810e5413e71dc9b9c7ec0e9cecd172c40e3517e0a151294175351cf0e037e9c35d8b50ba391a312976e7c4103845089e4
+DIST glibc-2.35-patches-6.tar.xz 57236 BLAKE2B a03845733e2f0ebe179523458695963d729b4211b4ce14310d55163cd33aff502f9e14a4bb0068410777e9b9bb5be4ef7ad1a1fd51debf9191dcf89dc9ff08b8 SHA512 59c5e1669677e969873f5bba38958316a3b32523cac628b97513aed864e191da10499edac77bb5e9a07179d14cf3c75073fd03e8427f7bcfd68fedcedc35083e
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.35-r3.ebuild b/sys-libs/glibc/glibc-2.35-r3.ebuild
new file mode 100644
index 000000000000..783d30779941
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.35-r3.ebuild
@@ -0,0 +1,1593 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# 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,9,10} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=6
+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"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 +clone3 compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	echo
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	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}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-04-22 10:46 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-04-22 10:46 UTC (permalink / raw
  To: gentoo-commits

commit:     410541fae25da99b5dfc45a386cc9d30db184840
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 22 10:45:42 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Apr 22 10:45:42 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=410541fa

sys-libs/glibc: Rekeyword 2.35-r3

Bug: https://bugs.gentoo.org/837734
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29069
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29071
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r3.ebuild b/sys-libs/glibc/glibc-2.35-r3.ebuild
index 783d30779941..ae91c31d5be5 100644
--- a/sys-libs/glibc/glibc-2.35-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r3.ebuild
@@ -26,7 +26,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-04-22 15:13 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-04-22 15:13 UTC (permalink / raw
  To: gentoo-commits

commit:     21cb076539ff8d24633c8630178e34c028ae0be8
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 22 15:12:46 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Apr 22 15:13:19 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=21cb0765

sys-libs/glibc: Add experimental loong patchset from xen0n

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |  1 +
 sys-libs/glibc/glibc-2.35-r3.ebuild | 10 +++++++++-
 sys-libs/glibc/metadata.xml         |  1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 04a4fc9125dd..324f1a9458dc 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,6 +16,7 @@ DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d91116
 DIST glibc-2.34-patches-15.tar.xz 146124 BLAKE2B f679f0fc27780173875178537cf996cbfb59bb844566388df0c351dec125eb02070571d4e2852742b43933d09c7a148a39bbc7b2b71fffebd7b8d9d3c16850ac SHA512 5224613e2288fcf027be224001306a84019ebe741114ee1b09d3de9b269dad0280a6dc4d88f4bc38dace501b2944a0098972589a1560756cb3da7e1b7341d672
 DIST glibc-2.34-patches-16.tar.xz 164648 BLAKE2B 78786a67109812942ac11bee9a880b9383aa61d0c2b006e3e7e635218842f49c6ce5b7c75597f7d317aa18fede0ca0c79a4bd436b8659ba6a2f1953848484d2a SHA512 acfc91e821cd8b4e57907c7aeaf1eac0bae1f8e244e4011f27819a8ba16a4e9c10fc675c6aaff992be81bba9373ec981fb598838f26aa247e7bd016e2cd786d2
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
+DIST glibc-2.35-loongarch-patches-20220422.tar.xz 44804 BLAKE2B b93720e45d23c8d17918ffaa480351499f4748bc08ab6e1f1fd3c681fcc0b08a3381188f5d4f14e6706baa5eb45c787bc635d0e8ea59712514012caf93992222 SHA512 28e2d02f07fcf61f76585dd59627314ed20ebe29ecd7ae7f5aea8db0704482fc024fee744cbee1776e666d14b80b1393f64cd2283e3c39be4c97ebe09efcdee2
 DIST glibc-2.35-patches-4.tar.xz 45456 BLAKE2B 47e1c5e4db4969da27f14816ac9b856f3a57e152139e071f0fd0ecf53b7ac2a0372a8dec7e9e51808d463d2e5b12a6acc9145bb0127a7f36cf1d19b96a0efa41 SHA512 39ca84ed5f3e74bccb8875a77188bb16f6b45b1b22843b4ccf8a7f792d35e05e8305929fbeede290ebb128722caf8277da03dbf4aee9261940765f8dfcd01561
 DIST glibc-2.35-patches-5.tar.xz 45632 BLAKE2B b49161139e8a9e6f4351b5954f38eaa3b0b16a444c370b906e2fcac8eb25c306e6f95474063e511a4f8bf48c0eade9509a6158a1019e32ec4b95c49f992405eb SHA512 5bf20061f24ad087aa0f22808cb0dfd810e5413e71dc9b9c7ec0e9cecd172c40e3517e0a151294175351cf0e037e9c35d8b50ba391a312976e7c4103845089e4
 DIST glibc-2.35-patches-6.tar.xz 57236 BLAKE2B a03845733e2f0ebe179523458695963d729b4211b4ce14310d55163cd33aff502f9e14a4bb0068410777e9b9bb5be4ef7ad1a1fd51debf9191dcf89dc9ff08b8 SHA512 59c5e1669677e969873f5bba38958316a3b32523cac628b97513aed864e191da10499edac77bb5e9a07179d14cf3c75073fd03e8427f7bcfd68fedcedc35083e

diff --git a/sys-libs/glibc/glibc-2.35-r3.ebuild b/sys-libs/glibc/glibc-2.35-r3.ebuild
index ae91c31d5be5..7040d0738b6a 100644
--- a/sys-libs/glibc/glibc-2.35-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r3.ebuild
@@ -29,6 +29,7 @@ else
 	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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-20220422.tar.xz )"
 fi
 
 RELEASE_VER=${PV}
@@ -43,7 +44,7 @@ SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${L
 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 +clone3 compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +static-libs suid systemd 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 +static-libs suid systemd systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -843,6 +844,7 @@ src_unpack() {
 
 		cd "${WORKDIR}" || die
 		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+		use experimental-loong && unpack glibc-2.35-loongarch-patches-20220422.tar.xz
 	fi
 
 	cd "${WORKDIR}" || die
@@ -861,6 +863,12 @@ 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

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index 613e58eff7ee..e00a008ac5c3 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -11,6 +11,7 @@
  <flag name="compile-locales">build *all* locales in src_install; this is generally meant for stage building only as it ignores /etc/locale.gen file and can be pretty slow</flag>
  <flag name="crypt">build and install libcrypt and crypt.h</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="gd">build memusage and memusagestat tools</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>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-04-23 23:54 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-04-23 23:54 UTC (permalink / raw
  To: gentoo-commits

commit:     417b5248aebfce61e37e95fd0fc17debc22f94fc
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 23 23:54:01 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 23 23:54:01 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=417b5248

sys-libs/glibc: Stabilize 2.34-r10 hppa, #833191

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r10.ebuild b/sys-libs/glibc/glibc-2.34-r10.ebuild
index e607faf13339..3c6ded33ef89 100644
--- a/sys-libs/glibc/glibc-2.34-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r10.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-04-24 23:33 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-04-24 23:33 UTC (permalink / raw
  To: gentoo-commits

commit:     8afecc68b8d689dbfdbff3b16ca50be66deb3cce
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 24 23:32:16 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Apr 24 23:32:43 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8afecc68

sys-libs/glibc: re-enable DT_HASH

It ends up breaking applications in unexpected ways (and it's not
obvious to the user what's happening), and after speaking to upstream,
it's not really even on their agenda to remove DT_HASH right now.

Given this seems to break not just some relatively niche (sorry!) things,
but some prominent Steam games now too, let's accelerate plans to roll
this out and do 2.34 (and 2.35, but that was more on the cards anyway)
too.

Bug: https://bugs.gentoo.org/347761
Bug: https://bugs.gentoo.org/527504
Bug: https://github.com/anyc/steam-overlay/issues/309
See: e5afbd004d49ecaa3a05b192a8bb0c21ea9d2f0e
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r12.ebuild | 1617 ++++++++++++++++++++++++++++++++++
 sys-libs/glibc/glibc-2.35-r4.ebuild  | 1596 +++++++++++++++++++++++++++++++++
 2 files changed, 3213 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.34-r12.ebuild b/sys-libs/glibc/glibc-2.34-r12.ebuild
new file mode 100644
index 000000000000..ea14a5159f6b
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.34-r12.ebuild
@@ -0,0 +1,1617 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
+# 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
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=16
+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"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 +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
+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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			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)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}

diff --git a/sys-libs/glibc/glibc-2.35-r4.ebuild b/sys-libs/glibc/glibc-2.35-r4.ebuild
new file mode 100644
index 000000000000..83385654477a
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.35-r4.ebuild
@@ -0,0 +1,1596 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# 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,9,10} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=6
+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"
+	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-20220422.tar.xz )"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 +clone3 compile-locales +crypt custom-cflags doc experimental-loong gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+		use experimental-loong && unpack glibc-2.35-loongarch-patches-20220422.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	echo
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-04-25 21:21 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-04-25 21:21 UTC (permalink / raw
  To: gentoo-commits

commit:     79969d5f5d0e7eb03a2bd19ddf8c8e4b8e9c456c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 25 21:21:11 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Apr 25 21:21:11 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=79969d5f

sys-libs/glibc: Remove old

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 -
 sys-libs/glibc/glibc-2.35-r1.ebuild | 1582 ----------------------------------
 sys-libs/glibc/glibc-2.35-r2.ebuild | 1593 -----------------------------------
 3 files changed, 3177 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 5ac560d81061..56eff785a4b1 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,8 +18,6 @@ DIST glibc-2.34-patches-16.tar.xz 164648 BLAKE2B 78786a67109812942ac11bee9a880b9
 DIST glibc-2.34-patches-17.tar.xz 241584 BLAKE2B e4eea130c331f64ba66e14a6ba318853141ee3e41b455cb45b8fdb702cae071dd307229dafcfcafcc41e5a56982f52c87e31d95295f824f1a2ae689a7e0f5b49 SHA512 c6a51b373be3986e1ad753541ccf73f29515b5df0f80e0450b26bed37e8c505e22e8f13e89554347e551819c8d89d30f306464e5d25cafa4a12400c112578dca
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-2.35-loongarch-patches-20220422.tar.xz 44804 BLAKE2B b93720e45d23c8d17918ffaa480351499f4748bc08ab6e1f1fd3c681fcc0b08a3381188f5d4f14e6706baa5eb45c787bc635d0e8ea59712514012caf93992222 SHA512 28e2d02f07fcf61f76585dd59627314ed20ebe29ecd7ae7f5aea8db0704482fc024fee744cbee1776e666d14b80b1393f64cd2283e3c39be4c97ebe09efcdee2
-DIST glibc-2.35-patches-4.tar.xz 45456 BLAKE2B 47e1c5e4db4969da27f14816ac9b856f3a57e152139e071f0fd0ecf53b7ac2a0372a8dec7e9e51808d463d2e5b12a6acc9145bb0127a7f36cf1d19b96a0efa41 SHA512 39ca84ed5f3e74bccb8875a77188bb16f6b45b1b22843b4ccf8a7f792d35e05e8305929fbeede290ebb128722caf8277da03dbf4aee9261940765f8dfcd01561
-DIST glibc-2.35-patches-5.tar.xz 45632 BLAKE2B b49161139e8a9e6f4351b5954f38eaa3b0b16a444c370b906e2fcac8eb25c306e6f95474063e511a4f8bf48c0eade9509a6158a1019e32ec4b95c49f992405eb SHA512 5bf20061f24ad087aa0f22808cb0dfd810e5413e71dc9b9c7ec0e9cecd172c40e3517e0a151294175351cf0e037e9c35d8b50ba391a312976e7c4103845089e4
 DIST glibc-2.35-patches-6.tar.xz 57236 BLAKE2B a03845733e2f0ebe179523458695963d729b4211b4ce14310d55163cd33aff502f9e14a4bb0068410777e9b9bb5be4ef7ad1a1fd51debf9191dcf89dc9ff08b8 SHA512 59c5e1669677e969873f5bba38958316a3b32523cac628b97513aed864e191da10499edac77bb5e9a07179d14cf3c75073fd03e8427f7bcfd68fedcedc35083e
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238

diff --git a/sys-libs/glibc/glibc-2.35-r1.ebuild b/sys-libs/glibc/glibc-2.35-r1.ebuild
deleted file mode 100644
index 891974bc21c4..000000000000
--- a/sys-libs/glibc/glibc-2.35-r1.ebuild
+++ /dev/null
@@ -1,1582 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# 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,9,10} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=4
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	filter-flags '-fstack-protector*'
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	echo
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.35-r2.ebuild b/sys-libs/glibc/glibc-2.35-r2.ebuild
deleted file mode 100644
index 22e2d5153f19..000000000000
--- a/sys-libs/glibc/glibc-2.35-r2.ebuild
+++ /dev/null
@@ -1,1593 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# 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,9,10} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=5
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 +clone3 compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	filter-flags '-fstack-protector*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	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
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	echo
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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
-				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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-04-25 21:21 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-04-25 21:21 UTC (permalink / raw
  To: gentoo-commits

commit:     9817f9ae971511d409ee01c536d881a7d0eff802
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 25 21:20:02 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Apr 25 21:20:02 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9817f9ae

sys-libs/glibc: 2.34 patchlevel 17 bump

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    1 +
 sys-libs/glibc/glibc-2.34-r13.ebuild | 1617 ++++++++++++++++++++++++++++++++++
 2 files changed, 1618 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 324f1a9458dc..5ac560d81061 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,6 +15,7 @@ DIST glibc-2.33-patches-11.tar.xz 143916 BLAKE2B ac13b3ccf9681bb6d3c35ecc33e268e
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-15.tar.xz 146124 BLAKE2B f679f0fc27780173875178537cf996cbfb59bb844566388df0c351dec125eb02070571d4e2852742b43933d09c7a148a39bbc7b2b71fffebd7b8d9d3c16850ac SHA512 5224613e2288fcf027be224001306a84019ebe741114ee1b09d3de9b269dad0280a6dc4d88f4bc38dace501b2944a0098972589a1560756cb3da7e1b7341d672
 DIST glibc-2.34-patches-16.tar.xz 164648 BLAKE2B 78786a67109812942ac11bee9a880b9383aa61d0c2b006e3e7e635218842f49c6ce5b7c75597f7d317aa18fede0ca0c79a4bd436b8659ba6a2f1953848484d2a SHA512 acfc91e821cd8b4e57907c7aeaf1eac0bae1f8e244e4011f27819a8ba16a4e9c10fc675c6aaff992be81bba9373ec981fb598838f26aa247e7bd016e2cd786d2
+DIST glibc-2.34-patches-17.tar.xz 241584 BLAKE2B e4eea130c331f64ba66e14a6ba318853141ee3e41b455cb45b8fdb702cae071dd307229dafcfcafcc41e5a56982f52c87e31d95295f824f1a2ae689a7e0f5b49 SHA512 c6a51b373be3986e1ad753541ccf73f29515b5df0f80e0450b26bed37e8c505e22e8f13e89554347e551819c8d89d30f306464e5d25cafa4a12400c112578dca
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-2.35-loongarch-patches-20220422.tar.xz 44804 BLAKE2B b93720e45d23c8d17918ffaa480351499f4748bc08ab6e1f1fd3c681fcc0b08a3381188f5d4f14e6706baa5eb45c787bc635d0e8ea59712514012caf93992222 SHA512 28e2d02f07fcf61f76585dd59627314ed20ebe29ecd7ae7f5aea8db0704482fc024fee744cbee1776e666d14b80b1393f64cd2283e3c39be4c97ebe09efcdee2
 DIST glibc-2.35-patches-4.tar.xz 45456 BLAKE2B 47e1c5e4db4969da27f14816ac9b856f3a57e152139e071f0fd0ecf53b7ac2a0372a8dec7e9e51808d463d2e5b12a6acc9145bb0127a7f36cf1d19b96a0efa41 SHA512 39ca84ed5f3e74bccb8875a77188bb16f6b45b1b22843b4ccf8a7f792d35e05e8305929fbeede290ebb128722caf8277da03dbf4aee9261940765f8dfcd01561

diff --git a/sys-libs/glibc/glibc-2.34-r13.ebuild b/sys-libs/glibc/glibc-2.34-r13.ebuild
new file mode 100644
index 000000000000..42654691812a
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.34-r13.ebuild
@@ -0,0 +1,1617 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
+# 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
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=17
+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"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 +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
+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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	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})}"
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			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)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	# All the checks...
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	# Consistency is not guaranteed between pkg_ and src_ ...
+	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
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	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 )
+
+	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--without-cvs
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable static-pie)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	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"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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
+				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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-04-26  8:55 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-04-26  8:55 UTC (permalink / raw
  To: gentoo-commits

commit:     b0e1b57d19796d09819ccac9c56423dce4b32351
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 26 08:54:40 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Apr 26 08:54:57 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b0e1b57d

sys-libs/glibc: Re-keyword 2.34-r13

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r13.ebuild b/sys-libs/glibc/glibc-2.34-r13.ebuild
index 42654691812a..1dc54c50ba14 100644
--- a/sys-libs/glibc/glibc-2.34-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r13.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-05-04 14:40 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-05-04 14:40 UTC (permalink / raw
  To: gentoo-commits

commit:     791a986503c177f7f7cb7c644f0bb496999ee9a4
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed May  4 14:39:05 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed May  4 14:39:05 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=791a9865

sys-libs/glibc: Stabilize 2.34-r13 ppc64, #842507

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r13.ebuild b/sys-libs/glibc/glibc-2.34-r13.ebuild
index 1dc54c50ba14..2813b576589b 100644
--- a/sys-libs/glibc/glibc-2.34-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r13.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-05-05  7:33 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-05-05  7:33 UTC (permalink / raw
  To: gentoo-commits

commit:     42ef25343a9b387ddc89d1b139ad075b495eee28
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Thu May  5 07:33:14 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Thu May  5 07:33:14 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=42ef2534

sys-libs/glibc: Stabilize 2.34-r13 sparc, #842507

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r13.ebuild b/sys-libs/glibc/glibc-2.34-r13.ebuild
index 2813b576589b..4ead44d79c52 100644
--- a/sys-libs/glibc/glibc-2.34-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r13.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-05-05  7:45 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-05-05  7:45 UTC (permalink / raw
  To: gentoo-commits

commit:     c48427797d495a4660a6eabc0ba96f4f88b420be
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Thu May  5 07:44:54 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Thu May  5 07:44:54 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4842779

sys-libs/glibc: Stabilize 2.34-r13 arm, #842507

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r13.ebuild b/sys-libs/glibc/glibc-2.34-r13.ebuild
index 0c0bc8b472b9..356d6dda310e 100644
--- a/sys-libs/glibc/glibc-2.34-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r13.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-05-05  7:45 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-05-05  7:45 UTC (permalink / raw
  To: gentoo-commits

commit:     85b7db6fa26495089ec2e70d8f3076852b9d1380
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Thu May  5 07:44:50 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Thu May  5 07:44:50 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=85b7db6f

sys-libs/glibc: Stabilize 2.34-r13 arm64, #842507

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r13.ebuild b/sys-libs/glibc/glibc-2.34-r13.ebuild
index 4ead44d79c52..0c0bc8b472b9 100644
--- a/sys-libs/glibc/glibc-2.34-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r13.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-05-10  9:54 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2022-05-10  9:54 UTC (permalink / raw
  To: gentoo-commits

commit:     5fdf9184090d258195321bf675837e8f090b548c
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Tue May 10 09:54:40 2022 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Tue May 10 09:54:40 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5fdf9184

sys-libs/glibc: amd64 stable wrt bug #842507

Package-Manager: Portage-3.0.30, Repoman-3.0.3
RepoMan-Options: --include-arches="amd64"
Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r13.ebuild b/sys-libs/glibc/glibc-2.34-r13.ebuild
index 356d6dda310e..dd432185bf98 100644
--- a/sys-libs/glibc/glibc-2.34-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r13.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-05-13  8:53 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2022-05-13  8:53 UTC (permalink / raw
  To: gentoo-commits

commit:     00d0dea84933a577a6f6f7cc05276e89aab1c513
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Fri May 13 08:53:36 2022 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Fri May 13 08:53:36 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=00d0dea8

sys-libs/glibc: x86 stable wrt bug #842507

Package-Manager: Portage-3.0.30, Repoman-3.0.3
RepoMan-Options: --include-arches="x86"
Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r13.ebuild b/sys-libs/glibc/glibc-2.34-r13.ebuild
index dd432185bf98..bf7187eac062 100644
--- a/sys-libs/glibc/glibc-2.34-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r13.ebuild
@@ -29,7 +29,7 @@ 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 ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-05-13 18:36 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-05-13 18:36 UTC (permalink / raw
  To: gentoo-commits

commit:     9b0d147c296144236fa653145ac454130586d594
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri May 13 05:23:45 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 13 18:26:48 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9b0d147c

sys-libs/glibc: filter -fsanitize=*

Just like with gcc.

(noticed when had CFLAGS set in env accidentally)

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 0ccad6a681c1..07bdba5ad0ed 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -429,8 +429,13 @@ setup_flags() {
 	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
 	replace-flags -O0 -O1
 
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
 	filter-flags '-fstack-protector*'
 
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
 	# See end of bug #830454; we handle this via USE=cet
 	filter-flags '-fcf-protection='
 }


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-05-14  1:52 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-05-14  1:52 UTC (permalink / raw
  To: gentoo-commits

commit:     ea1b9408e8f6b22c0a1a92f0c3612008a1ea4475
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat May 14 01:52:12 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat May 14 01:52:12 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ea1b9408

sys-libs/glibc: add Python 3.10 to 2.34-r13

It's been long enough and there's guides on the wiki
(https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Error_mentions_default_version_not_yet_installed_.28old_install.29)
if folks hit a circular dependency anyway.

Needed as we're moving forward to Python 3.10 default soon and this
will reduce confusion.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r13.ebuild | 5 +----
 sys-libs/glibc/glibc-2.35-r3.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.35-r4.ebuild  | 2 +-
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.34-r13.ebuild b/sys-libs/glibc/glibc-2.34-r13.ebuild
index bf7187eac062..2f9a3312f793 100644
--- a/sys-libs/glibc/glibc-2.34-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r13.ebuild
@@ -6,10 +6,7 @@ EAPI=7
 # Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
 # Please read & adapt the page as necessary if obsolete.
 
-# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
-# 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} )
+PYTHON_COMPAT=( python3_{8..10} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \

diff --git a/sys-libs/glibc/glibc-2.35-r3.ebuild b/sys-libs/glibc/glibc-2.35-r3.ebuild
index 7040d0738b6a..c656b1b35881 100644
--- a/sys-libs/glibc/glibc-2.35-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r3.ebuild
@@ -6,7 +6,7 @@ EAPI=7
 # 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,9,10} )
+PYTHON_COMPAT=( python3_{8..10} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \

diff --git a/sys-libs/glibc/glibc-2.35-r4.ebuild b/sys-libs/glibc/glibc-2.35-r4.ebuild
index c67cc3205f9f..98b8484013e6 100644
--- a/sys-libs/glibc/glibc-2.35-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r4.ebuild
@@ -6,7 +6,7 @@ EAPI=7
 # 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,9,10} )
+PYTHON_COMPAT=( python3_{8..10} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-05-14  9:30 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-05-14  9:30 UTC (permalink / raw
  To: gentoo-commits

commit:     676fea386d4a60eefc7497a03c30bdcdb5847055
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat May 14 09:30:39 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat May 14 09:30:39 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=676fea38

sys-libs/glibc: Stabilize 2.34-r13 ppc, #842507

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r13.ebuild b/sys-libs/glibc/glibc-2.34-r13.ebuild
index 93740b3ad5bd..3fcb285a7034 100644
--- a/sys-libs/glibc/glibc-2.34-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r13.ebuild
@@ -26,7 +26,7 @@ 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 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-05-14  9:30 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-05-14  9:30 UTC (permalink / raw
  To: gentoo-commits

commit:     ddd1dd9085e03d5c07fb754c03bf350748c195c9
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat May 14 09:30:36 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat May 14 09:30:36 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ddd1dd90

sys-libs/glibc: Stabilize 2.34-r13 hppa, #842507

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.34-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.34-r13.ebuild b/sys-libs/glibc/glibc-2.34-r13.ebuild
index 2f9a3312f793..93740b3ad5bd 100644
--- a/sys-libs/glibc/glibc-2.34-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r13.ebuild
@@ -26,7 +26,7 @@ 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 ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-05-15  1:00 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-05-15  1:00 UTC (permalink / raw
  To: gentoo-commits

commit:     01ad1fecda61778081c5c1eaa051d7f6f2f4456c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat May  7 06:54:10 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun May 15 01:00:10 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=01ad1fec

sys-libs/glibc: egrep -> grep -E

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild  | 6 +++---
 sys-libs/glibc/glibc-2.30-r9.ebuild  | 6 +++---
 sys-libs/glibc/glibc-2.31-r7.ebuild  | 6 +++---
 sys-libs/glibc/glibc-2.32-r8.ebuild  | 6 +++---
 sys-libs/glibc/glibc-2.33-r13.ebuild | 2 +-
 sys-libs/glibc/glibc-2.34-r10.ebuild | 2 +-
 sys-libs/glibc/glibc-2.34-r11.ebuild | 2 +-
 sys-libs/glibc/glibc-2.34-r12.ebuild | 2 +-
 sys-libs/glibc/glibc-2.34-r13.ebuild | 2 +-
 sys-libs/glibc/glibc-2.35-r3.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.35-r4.ebuild  | 2 +-
 sys-libs/glibc/glibc-9999.ebuild     | 2 +-
 12 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index 933241c81394..d1dff3cf1b44 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -592,7 +592,7 @@ sanity_prechecks() {
 	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
 		local entry
 		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+			if ! grep -E -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
 				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
 				eerror "Please make sure you have 'files' entries for"
 				eerror "'passwd:', 'group:' and 'shadow:' databases."
@@ -1302,7 +1302,7 @@ pkg_postinst() {
 	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"

diff --git a/sys-libs/glibc/glibc-2.30-r9.ebuild b/sys-libs/glibc/glibc-2.30-r9.ebuild
index 88282a7f5956..7e8c90410820 100644
--- a/sys-libs/glibc/glibc-2.30-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r9.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -639,7 +639,7 @@ sanity_prechecks() {
 	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
 		local entry
 		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+			if ! grep -E -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
 				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
 				eerror "Please make sure you have 'files' entries for"
 				eerror "'passwd:', 'group:' and 'shadow:' databases."
@@ -1458,7 +1458,7 @@ pkg_postinst() {
 	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"

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index 975a2dec59c9..61ff26514e5e 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -633,7 +633,7 @@ sanity_prechecks() {
 	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
 		local entry
 		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+			if ! grep -E -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
 				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
 				eerror "Please make sure you have 'files' entries for"
 				eerror "'passwd:', 'group:' and 'shadow:' databases."
@@ -1486,7 +1486,7 @@ pkg_postinst() {
 	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"

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index 101254fce5ab..361d004c77da 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -650,7 +650,7 @@ sanity_prechecks() {
 	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
 		local entry
 		for entry in passwd group shadow; do
-			if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
+			if ! grep -E -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
 				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
 				eerror "Please make sure you have 'files' entries for"
 				eerror "'passwd:', 'group:' and 'shadow:' databases."
@@ -1504,7 +1504,7 @@ pkg_postinst() {
 	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"

diff --git a/sys-libs/glibc/glibc-2.33-r13.ebuild b/sys-libs/glibc/glibc-2.33-r13.ebuild
index cf8ae91b27fa..9fd5d468641c 100644
--- a/sys-libs/glibc/glibc-2.33-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r13.ebuild
@@ -1573,7 +1573,7 @@ pkg_postinst() {
 	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"

diff --git a/sys-libs/glibc/glibc-2.34-r10.ebuild b/sys-libs/glibc/glibc-2.34-r10.ebuild
index 3c6ded33ef89..7d08b77d99bc 100644
--- a/sys-libs/glibc/glibc-2.34-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r10.ebuild
@@ -1599,7 +1599,7 @@ pkg_postinst() {
 	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"

diff --git a/sys-libs/glibc/glibc-2.34-r11.ebuild b/sys-libs/glibc/glibc-2.34-r11.ebuild
index 3cf633bea543..913dfec2ba3b 100644
--- a/sys-libs/glibc/glibc-2.34-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r11.ebuild
@@ -1599,7 +1599,7 @@ pkg_postinst() {
 	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"

diff --git a/sys-libs/glibc/glibc-2.34-r12.ebuild b/sys-libs/glibc/glibc-2.34-r12.ebuild
index ea14a5159f6b..ed59190c49b3 100644
--- a/sys-libs/glibc/glibc-2.34-r12.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r12.ebuild
@@ -1594,7 +1594,7 @@ pkg_postinst() {
 	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"

diff --git a/sys-libs/glibc/glibc-2.34-r13.ebuild b/sys-libs/glibc/glibc-2.34-r13.ebuild
index 3fcb285a7034..1cd002c9c54a 100644
--- a/sys-libs/glibc/glibc-2.34-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r13.ebuild
@@ -1591,7 +1591,7 @@ pkg_postinst() {
 	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"

diff --git a/sys-libs/glibc/glibc-2.35-r3.ebuild b/sys-libs/glibc/glibc-2.35-r3.ebuild
index c656b1b35881..418508596bc4 100644
--- a/sys-libs/glibc/glibc-2.35-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r3.ebuild
@@ -1578,7 +1578,7 @@ pkg_postinst() {
 	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"

diff --git a/sys-libs/glibc/glibc-2.35-r4.ebuild b/sys-libs/glibc/glibc-2.35-r4.ebuild
index 98b8484013e6..6c6fb048ea14 100644
--- a/sys-libs/glibc/glibc-2.35-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r4.ebuild
@@ -1573,7 +1573,7 @@ pkg_postinst() {
 	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"

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 07bdba5ad0ed..b719a898e915 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1563,7 +1563,7 @@ pkg_postinst() {
 	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"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-05-15 17:02 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-05-15 17:02 UTC (permalink / raw
  To: gentoo-commits

commit:     706c77eb3eed6465b2e486623dccd355d079d69e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun May 15 17:02:11 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun May 15 17:02:11 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=706c77eb

sys-libs/glibc: remove old

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    2 -
 sys-libs/glibc/glibc-2.34-r10.ebuild | 1622 ----------------------------------
 sys-libs/glibc/glibc-2.34-r11.ebuild | 1622 ----------------------------------
 sys-libs/glibc/glibc-2.34-r12.ebuild | 1617 ---------------------------------
 sys-libs/glibc/glibc-2.35-r3.ebuild  | 1601 ---------------------------------
 5 files changed, 6464 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 56eff785a4b1..a1bf7ef861c3 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -13,8 +13,6 @@ DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a
 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
 DIST glibc-2.33-patches-11.tar.xz 143916 BLAKE2B ac13b3ccf9681bb6d3c35ecc33e268ea3f67c1809f916019e692dc83e3ce809402a45548da5ca6c7c30d2a45a2638f9fa4254c0355bd4c53bdb216f17aa4e28b SHA512 0ee1dfcf9574543d49ab4fbfe53571258422b6e82b9d12a33e411cee7e517821a4c45c24962b5120783a4efc898afdfa170d33486cc74d94c526bdd14cc84300
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
-DIST glibc-2.34-patches-15.tar.xz 146124 BLAKE2B f679f0fc27780173875178537cf996cbfb59bb844566388df0c351dec125eb02070571d4e2852742b43933d09c7a148a39bbc7b2b71fffebd7b8d9d3c16850ac SHA512 5224613e2288fcf027be224001306a84019ebe741114ee1b09d3de9b269dad0280a6dc4d88f4bc38dace501b2944a0098972589a1560756cb3da7e1b7341d672
-DIST glibc-2.34-patches-16.tar.xz 164648 BLAKE2B 78786a67109812942ac11bee9a880b9383aa61d0c2b006e3e7e635218842f49c6ce5b7c75597f7d317aa18fede0ca0c79a4bd436b8659ba6a2f1953848484d2a SHA512 acfc91e821cd8b4e57907c7aeaf1eac0bae1f8e244e4011f27819a8ba16a4e9c10fc675c6aaff992be81bba9373ec981fb598838f26aa247e7bd016e2cd786d2
 DIST glibc-2.34-patches-17.tar.xz 241584 BLAKE2B e4eea130c331f64ba66e14a6ba318853141ee3e41b455cb45b8fdb702cae071dd307229dafcfcafcc41e5a56982f52c87e31d95295f824f1a2ae689a7e0f5b49 SHA512 c6a51b373be3986e1ad753541ccf73f29515b5df0f80e0450b26bed37e8c505e22e8f13e89554347e551819c8d89d30f306464e5d25cafa4a12400c112578dca
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-2.35-loongarch-patches-20220422.tar.xz 44804 BLAKE2B b93720e45d23c8d17918ffaa480351499f4748bc08ab6e1f1fd3c681fcc0b08a3381188f5d4f14e6706baa5eb45c787bc635d0e8ea59712514012caf93992222 SHA512 28e2d02f07fcf61f76585dd59627314ed20ebe29ecd7ae7f5aea8db0704482fc024fee744cbee1776e666d14b80b1393f64cd2283e3c39be4c97ebe09efcdee2

diff --git a/sys-libs/glibc/glibc-2.34-r10.ebuild b/sys-libs/glibc/glibc-2.34-r10.ebuild
deleted file mode 100644
index 7d08b77d99bc..000000000000
--- a/sys-libs/glibc/glibc-2.34-r10.ebuild
+++ /dev/null
@@ -1,1622 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
-# 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
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=15
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			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)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	filter-flags '-fstack-protector*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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="${SYSROOT}" binutils-config -B)
-		local current_gcc_path=$(env ROOT="${SYSROOT}" 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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	# Contained within our next patchset version but build-time only fix
-	# (pretty much, anyway) so just apply manually here for now until
-	# next patchset version rolled.
-	eapply "${FILESDIR}"/2.34/${P}-hppa-asm-getcontext-fixes.patch
-
-	# TODO: We can drop this once patch is gone from our patchset
-	append-cppflags -DGENTOO_USE_CLONE3
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.34-r11.ebuild b/sys-libs/glibc/glibc-2.34-r11.ebuild
deleted file mode 100644
index 913dfec2ba3b..000000000000
--- a/sys-libs/glibc/glibc-2.34-r11.ebuild
+++ /dev/null
@@ -1,1622 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
-# 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
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=16
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 +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
-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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			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)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	filter-flags '-fstack-protector*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	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
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.34-r12.ebuild b/sys-libs/glibc/glibc-2.34-r12.ebuild
deleted file mode 100644
index ed59190c49b3..000000000000
--- a/sys-libs/glibc/glibc-2.34-r12.ebuild
+++ /dev/null
@@ -1,1617 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
-# 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
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=16
-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"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 +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
-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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	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})}"
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			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)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	filter-flags '-fstack-protector*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	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
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	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
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable static-pie)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.35-r3.ebuild b/sys-libs/glibc/glibc-2.35-r3.ebuild
deleted file mode 100644
index 418508596bc4..000000000000
--- a/sys-libs/glibc/glibc-2.35-r3.ebuild
+++ /dev/null
@@ -1,1601 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# 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..10} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=6
-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"
-	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-20220422.tar.xz )"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 +clone3 compile-locales +crypt custom-cflags doc experimental-loong gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	filter-flags '-fstack-protector*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-		use experimental-loong && unpack glibc-2.35-loongarch-patches-20220422.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		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
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	echo
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-05-17 21:18 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-05-17 21:18 UTC (permalink / raw
  To: gentoo-commits

commit:     40aa70ae06da9420817e4c843fd2da016c4d6d79
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue May 17 21:18:28 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue May 17 21:18:42 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=40aa70ae

sys-libs/glibc: 2.35 patchlevel revbump; untested, no keywords

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.35-r5.ebuild | 1596 +++++++++++++++++++++++++++++++++++
 2 files changed, 1597 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index a1bf7ef861c3..1d438fcb361c 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,6 +17,7 @@ DIST glibc-2.34-patches-17.tar.xz 241584 BLAKE2B e4eea130c331f64ba66e14a6ba31885
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-2.35-loongarch-patches-20220422.tar.xz 44804 BLAKE2B b93720e45d23c8d17918ffaa480351499f4748bc08ab6e1f1fd3c681fcc0b08a3381188f5d4f14e6706baa5eb45c787bc635d0e8ea59712514012caf93992222 SHA512 28e2d02f07fcf61f76585dd59627314ed20ebe29ecd7ae7f5aea8db0704482fc024fee744cbee1776e666d14b80b1393f64cd2283e3c39be4c97ebe09efcdee2
 DIST glibc-2.35-patches-6.tar.xz 57236 BLAKE2B a03845733e2f0ebe179523458695963d729b4211b4ce14310d55163cd33aff502f9e14a4bb0068410777e9b9bb5be4ef7ad1a1fd51debf9191dcf89dc9ff08b8 SHA512 59c5e1669677e969873f5bba38958316a3b32523cac628b97513aed864e191da10499edac77bb5e9a07179d14cf3c75073fd03e8427f7bcfd68fedcedc35083e
+DIST glibc-2.35-patches-7.tar.xz 163840 BLAKE2B 55352eeaf70f74fd8fcd21bd7f3ba14121b496dcfb59e06b5a73be36838dda4b39fc22201c4320c0c38a454c7f1539aae7f3307107e460bede25be33c0525c11 SHA512 d39bb2fecad8cd9213c61e279823f89c3daf9a4f630ac71503df2e9bfb74e019c996bed9a93aaad89083a729a1d3792e7ed8313ac54d757f47d5614ac3469e59
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.35-r5.ebuild b/sys-libs/glibc/glibc-2.35-r5.ebuild
new file mode 100644
index 000000000000..f94584823dcc
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.35-r5.ebuild
@@ -0,0 +1,1596 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# 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..10} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=7
+PATCH_DEV=dilfridge
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	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-20220422.tar.xz )"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 +clone3 compile-locales +crypt custom-cflags doc experimental-loong gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+		use experimental-loong && unpack glibc-2.35-loongarch-patches-20220422.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	echo
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-05-18 10:02 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-05-18 10:02 UTC (permalink / raw
  To: gentoo-commits

commit:     5bd4acf02963aa6c789a2c6ad94eee040cd7a4f5
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed May 18 10:02:23 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed May 18 10:02:41 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5bd4acf0

sys-libs/glibc: Re-keyword 2.35-r5

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r5.ebuild b/sys-libs/glibc/glibc-2.35-r5.ebuild
index f94584823dcc..88ec2acf92c1 100644
--- a/sys-libs/glibc/glibc-2.35-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r5.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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-20220422.tar.xz )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-05-25  0:09 WANG Xuerui
  0 siblings, 0 replies; 1076+ messages in thread
From: WANG Xuerui @ 2022-05-25  0:09 UTC (permalink / raw
  To: gentoo-commits

commit:     959d362a586bf7df64345643e1e7e25e530a4b92
Author:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
AuthorDate: Sun May 22 06:10:56 2022 +0000
Commit:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
CommitDate: Wed May 25 00:08:43 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=959d362a

sys-libs/glibc: add 2.35-r6 with loong patchset version 20220522

Updates the patchset to Loongson's v4 branch, and removes usage of
newfstatat. Other arches are not touched but dropped keywords as a
precaution.

Closes: https://github.com/gentoo/gentoo/pull/25592
Reviewed-by: Sam James <sam <AT> gentoo.org>
Signed-off-by: WANG Xuerui <xen0n <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.35-r6.ebuild | 1597 +++++++++++++++++++++++++++++++++++
 2 files changed, 1598 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 1d438fcb361c..9d09909312d8 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,6 +16,7 @@ DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d91116
 DIST glibc-2.34-patches-17.tar.xz 241584 BLAKE2B e4eea130c331f64ba66e14a6ba318853141ee3e41b455cb45b8fdb702cae071dd307229dafcfcafcc41e5a56982f52c87e31d95295f824f1a2ae689a7e0f5b49 SHA512 c6a51b373be3986e1ad753541ccf73f29515b5df0f80e0450b26bed37e8c505e22e8f13e89554347e551819c8d89d30f306464e5d25cafa4a12400c112578dca
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-2.35-loongarch-patches-20220422.tar.xz 44804 BLAKE2B b93720e45d23c8d17918ffaa480351499f4748bc08ab6e1f1fd3c681fcc0b08a3381188f5d4f14e6706baa5eb45c787bc635d0e8ea59712514012caf93992222 SHA512 28e2d02f07fcf61f76585dd59627314ed20ebe29ecd7ae7f5aea8db0704482fc024fee744cbee1776e666d14b80b1393f64cd2283e3c39be4c97ebe09efcdee2
+DIST glibc-2.35-loongarch-patches-20220522.tar.xz 44728 BLAKE2B 09e7a061f3269ebd763cd700f7c23e6cd7aab738d87ee31f76a81281920c4e5e207964c79104cd75f0a2e07b77344c2a730a9063344aa1483cd3d9aeac87de40 SHA512 21f13892fb52ec753856d5559b032c2be3a76d1cf940127222f7aa878548ce7e6ea0d2ff8791ddb91aaa2b77ce17131cd2fb2ebbdaa99443bf0a6b4c81f7388d
 DIST glibc-2.35-patches-6.tar.xz 57236 BLAKE2B a03845733e2f0ebe179523458695963d729b4211b4ce14310d55163cd33aff502f9e14a4bb0068410777e9b9bb5be4ef7ad1a1fd51debf9191dcf89dc9ff08b8 SHA512 59c5e1669677e969873f5bba38958316a3b32523cac628b97513aed864e191da10499edac77bb5e9a07179d14cf3c75073fd03e8427f7bcfd68fedcedc35083e
 DIST glibc-2.35-patches-7.tar.xz 163840 BLAKE2B 55352eeaf70f74fd8fcd21bd7f3ba14121b496dcfb59e06b5a73be36838dda4b39fc22201c4320c0c38a454c7f1539aae7f3307107e460bede25be33c0525c11 SHA512 d39bb2fecad8cd9213c61e279823f89c3daf9a4f630ac71503df2e9bfb74e019c996bed9a93aaad89083a729a1d3792e7ed8313ac54d757f47d5614ac3469e59
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66

diff --git a/sys-libs/glibc/glibc-2.35-r6.ebuild b/sys-libs/glibc/glibc-2.35-r6.ebuild
new file mode 100644
index 000000000000..1da6dd8768e4
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.35-r6.ebuild
@@ -0,0 +1,1597 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# 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..10} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=7
+PATCH_DEV=dilfridge
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~loong"
+	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.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 +clone3 compile-locales +crypt custom-cflags doc experimental-loong gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	echo
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-06-05 22:07 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-06-05 22:07 UTC (permalink / raw
  To: gentoo-commits

commit:     44ae9e2b45e12f65fe99a1afb6ce1d84abb0f0f9
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Jun  5 22:06:42 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Jun  5 22:07:37 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=44ae9e2b

sys-libs/glibc: 2.35 patchlevel bump, untested, no keywords

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.35-r7.ebuild | 1596 +++++++++++++++++++++++++++++++++++
 2 files changed, 1597 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 9d09909312d8..83ff9fc22d84 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,6 +19,7 @@ DIST glibc-2.35-loongarch-patches-20220422.tar.xz 44804 BLAKE2B b93720e45d23c8d1
 DIST glibc-2.35-loongarch-patches-20220522.tar.xz 44728 BLAKE2B 09e7a061f3269ebd763cd700f7c23e6cd7aab738d87ee31f76a81281920c4e5e207964c79104cd75f0a2e07b77344c2a730a9063344aa1483cd3d9aeac87de40 SHA512 21f13892fb52ec753856d5559b032c2be3a76d1cf940127222f7aa878548ce7e6ea0d2ff8791ddb91aaa2b77ce17131cd2fb2ebbdaa99443bf0a6b4c81f7388d
 DIST glibc-2.35-patches-6.tar.xz 57236 BLAKE2B a03845733e2f0ebe179523458695963d729b4211b4ce14310d55163cd33aff502f9e14a4bb0068410777e9b9bb5be4ef7ad1a1fd51debf9191dcf89dc9ff08b8 SHA512 59c5e1669677e969873f5bba38958316a3b32523cac628b97513aed864e191da10499edac77bb5e9a07179d14cf3c75073fd03e8427f7bcfd68fedcedc35083e
 DIST glibc-2.35-patches-7.tar.xz 163840 BLAKE2B 55352eeaf70f74fd8fcd21bd7f3ba14121b496dcfb59e06b5a73be36838dda4b39fc22201c4320c0c38a454c7f1539aae7f3307107e460bede25be33c0525c11 SHA512 d39bb2fecad8cd9213c61e279823f89c3daf9a4f630ac71503df2e9bfb74e019c996bed9a93aaad89083a729a1d3792e7ed8313ac54d757f47d5614ac3469e59
+DIST glibc-2.35-patches-8.tar.xz 178384 BLAKE2B 89ca0ab51f60a25b0d0c00e619f35e71cb18f1794f3656c5e10d87e41f461c43aca51e40f3d8375014d485100098e18f333d3f99888e062f54e632eabd6ebc31 SHA512 cb0945eda142eebb71315b0fcf570e9410acce3b1153fdc3a9148151a7a37624d4cfb91d06ecf20b4045c70051d4c297f0f58f57ba56d9b0a4304b6b7ce2783f
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.35-r7.ebuild b/sys-libs/glibc/glibc-2.35-r7.ebuild
new file mode 100644
index 000000000000..6ce1a5fa2ca8
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.35-r7.ebuild
@@ -0,0 +1,1596 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# 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..10} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=8
+PATCH_DEV=dilfridge
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	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.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 +clone3 compile-locales +crypt custom-cflags doc experimental-loong gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				export CFLAGS="-march=${t} ${CFLAGS}"
+				einfo "Auto adding -march=${t} to CFLAGS #185404"
+			fi
+		;;
+		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})"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	echo
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
+}
+
+do_src_test() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-06-06 16:04 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-06-06 16:04 UTC (permalink / raw
  To: gentoo-commits

commit:     2bbf56eedf278d36b1f8208dbfd47f7db4e12169
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  6 16:03:45 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jun  6 16:03:45 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2bbf56ee

sys-libs/glibc: Give the testsuite a bit more time

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r7.ebuild | 5 ++++-
 sys-libs/glibc/glibc-9999.ebuild    | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.35-r7.ebuild b/sys-libs/glibc/glibc-2.35-r7.ebuild
index 6ce1a5fa2ca8..05fbd55a47fc 100644
--- a/sys-libs/glibc/glibc-2.35-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r7.ebuild
@@ -1191,7 +1191,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() {

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index b719a898e915..036cc591795c 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1181,7 +1181,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() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-06-06 18:01 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-06-06 18:01 UTC (permalink / raw
  To: gentoo-commits

commit:     1932e6b603759f3791872589fa025f8190e3a63e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  6 18:01:15 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jun  6 18:01:44 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1932e6b6

sys-libs/glibc: rekeyword 2.35-r7

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r7.ebuild b/sys-libs/glibc/glibc-2.35-r7.ebuild
index 05fbd55a47fc..db24482b2097 100644
--- a/sys-libs/glibc/glibc-2.35-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r7.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-06-08 10:42 Michał Górny
  0 siblings, 0 replies; 1076+ messages in thread
From: Michał Górny @ 2022-06-08 10:42 UTC (permalink / raw
  To: gentoo-commits

commit:     60a2fa76e6bc8dda538de274eab35d88a6dd1ba9
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  8 10:41:51 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jun  8 10:42:06 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=60a2fa76

sys-libs/glibc: Enable py3.11

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r7.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.35-r7.ebuild b/sys-libs/glibc/glibc-2.35-r7.ebuild
index db24482b2097..a9b4a0d16717 100644
--- a/sys-libs/glibc/glibc-2.35-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r7.ebuild
@@ -6,7 +6,7 @@ EAPI=7
 # 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..10} )
+PYTHON_COMPAT=( python3_{8..11} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 036cc591795c..8c330f867cbc 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -6,7 +6,7 @@ EAPI=7
 # 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,9,10} )
+PYTHON_COMPAT=( python3_{8..11} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-06-08 22:30 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-06-08 22:30 UTC (permalink / raw
  To: gentoo-commits

commit:     c80fd324b0ab7cafb11847dff2d6c7b23ade2997
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  8 22:29:21 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun  8 22:30:36 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c80fd324

sys-libs/glibc: fix linux-headers check

The comment in the ebuild tries to say it all, but the gist is that
because the environment (which includes installed packages and their versions!)
isn't (necessarily) consistent b/t pkg_pretend and pkg_setup, and pkg_pretend
is run before any packages are merged at all, if one has an old linux-headers
installed, and a new linux-headers is queued to upgrade before glibc, the
emerge will still die in pkg_pretend b/c it's run before the new linux-headers
(or indeed anything) gets merged.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 8c330f867cbc..2a030e2f9928 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -785,11 +785,19 @@ sanity_prechecks() {
 				fi
 			fi
 
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
 			fi
 		fi
 	fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-06-25 21:40 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-06-25 21:40 UTC (permalink / raw
  To: gentoo-commits

commit:     b10e45c2428e392e948b7f38784cb0a796f2dbb8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 25 21:21:21 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun 25 21:39:29 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b10e45c2

sys-libs/glibc: slight->some for stack-realign description

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/metadata.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index c64d2052ed07..eb25b52087e2 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -17,7 +17,7 @@
 		<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="ssp">protect stack of glibc internals</flag>
-		<flag name="stack-realign">Realign the stack in the 32-bit build for compatibility with older binaries at slight performance cost</flag>
+		<flag name="stack-realign">Realign the stack in the 32-bit build for compatibility with older binaries at some performance cost</flag>
 		<flag name="static-pie">Enable static PIE support (runtime files for -static-pie gcc option).</flag>
 		<flag name="suid">Make internal pt_chown helper setuid -- not needed if using Linux and have /dev/pts mounted with gid=5</flag>
 		<flag name="systemtap">enable systemtap static probe points</flag>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-06-25 21:40 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-06-25 21:40 UTC (permalink / raw
  To: gentoo-commits

commit:     c3e6cb5b191daa60b19f25f7f30765e85b962dc1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 25 21:20:46 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun 25 21:39:28 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c3e6cb5b

sys-libs/glibc: update metadata indentation

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/metadata.xml | 48 ++++++++++++++++++++++-----------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index bcaf604fa542..c64d2052ed07 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -1,28 +1,28 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
-<maintainer type="project">
- <email>toolchain@gentoo.org</email>
- <name>Gentoo Toolchain Project</name>
-</maintainer>
-<use>
- <flag name="cet">Enable Intel Control-flow Enforcement Technology (needs binutils 2.29 and gcc 8)</flag>
- <flag name="clone3">Enable the new clone3 syscall within glibc. Can be disabled to allow compatibility with older Electron applications.</flag>
- <flag name="compile-locales">build *all* locales in src_install; this is generally meant for stage building only as it ignores /etc/locale.gen file and can be pretty slow</flag>
- <flag name="crypt">build and install libcrypt and crypt.h</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="gd">build memusage and memusagestat tools</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="nscd">Build, and enable support for, the Name Service Cache Daemon</flag>
- <flag name="ssp">protect stack of glibc internals</flag>
- <flag name="stack-realign">Realign the stack in the 32-bit build for compatibility with older binaries at slight performance cost</flag>
- <flag name="static-pie">Enable static PIE support (runtime files for -static-pie gcc option).</flag>
- <flag name="suid">Make internal pt_chown helper setuid -- not needed if using Linux and have /dev/pts mounted with gid=5</flag>
- <flag name="systemtap">enable systemtap static probe points</flag>
-</use>
-<upstream>
- <remote-id type="cpe">cpe:/a:gnu:glibc</remote-id>
-</upstream>
+	<maintainer type="project">
+		<email>toolchain@gentoo.org</email>
+		<name>Gentoo Toolchain Project</name>
+	</maintainer>
+	<use>
+		<flag name="cet">Enable Intel Control-flow Enforcement Technology (needs binutils 2.29 and gcc 8)</flag>
+		<flag name="clone3">Enable the new clone3 syscall within glibc. Can be disabled to allow compatibility with older Electron applications.</flag>
+		<flag name="compile-locales">build *all* locales in src_install; this is generally meant for stage building only as it ignores /etc/locale.gen file and can be pretty slow</flag>
+		<flag name="crypt">build and install libcrypt and crypt.h</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="gd">build memusage and memusagestat tools</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="nscd">Build, and enable support for, the Name Service Cache Daemon</flag>
+		<flag name="ssp">protect stack of glibc internals</flag>
+		<flag name="stack-realign">Realign the stack in the 32-bit build for compatibility with older binaries at slight performance cost</flag>
+		<flag name="static-pie">Enable static PIE support (runtime files for -static-pie gcc option).</flag>
+		<flag name="suid">Make internal pt_chown helper setuid -- not needed if using Linux and have /dev/pts mounted with gid=5</flag>
+		<flag name="systemtap">enable systemtap static probe points</flag>
+	</use>
+	<upstream>
+		<remote-id type="cpe">cpe:/a:gnu:glibc</remote-id>
+	</upstream>
 </pkgmetadata>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-06-25 21:40 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-06-25 21:40 UTC (permalink / raw
  To: gentoo-commits

commit:     02aa6328a720c86d0157c4582f7e5bac72ae9296
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 11 21:11:12 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun 25 21:39:28 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=02aa6328

sys-libs/glibc: Add stack-realign flag for compat with old 32-bit x86 binaries

Older 32-bit x86 binaries aligned the stack to 4 bytes, whereas modern
binaries align to 16 bytes. These older binaries sometimes segfault when
newer libraries use SSE instructions. This is becoming increasingly
common. Applying the -mstackrealign flag to the 32-bit build works
around the issue but at a performance cost. Other popular
distributions always apply this.

[sam: There's no good choices here. As Ionen pointed out (I'd missed
any reports of this), this ends up getting worse with GCC 12's
default-on vectorisation at -O2. Let's make it optional for now for
32-bit/x86 (irrelevant for other arches, it's specific to x86 ABI).

ncurses is going to need similar treatment. If we end up having
to do this for far more packages, we may revisit and e.g.
just append-flags in ebuilds for right ABI and tell users
to set -mno-stackrealign, or similar.

Another option would be to set this globally by default (again,
this is only ever for x86), but it'd possibly be a big performance
hit (and bad enough doing it in glibc, but it's unavoidable).

The only saving grace here is that there aren't _that_ many
libraries with such longevity & ABI stability from back then
that older applications are using.]

Bug: https://bugs.gentoo.org/616402
Bug: https://github.com/taviso/123elf/issues/12
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/25858
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r7.ebuild | 31 ++++++++++++++++++-------------
 sys-libs/glibc/glibc-9999.ebuild    | 31 ++++++++++++++++++-------------
 sys-libs/glibc/metadata.xml         |  1 +
 3 files changed, 37 insertions(+), 26 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.35-r7.ebuild b/sys-libs/glibc/glibc-2.35-r7.ebuild
index a9b4a0d16717..3e8358532526 100644
--- a/sys-libs/glibc/glibc-2.35-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r7.ebuild
@@ -44,7 +44,7 @@ SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${L
 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 +clone3 compile-locales +crypt custom-cflags doc experimental-loong gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +static-libs suid systemd 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"
@@ -305,22 +305,27 @@ 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"
 			fi
 		;;
 		mips)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2a030e2f9928..b35b2febd192 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -44,7 +44,7 @@ SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${L
 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 suid systemd systemtap test vanilla"
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc 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"
@@ -305,22 +305,27 @@ 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"
 			fi
 		;;
 		mips)

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index e00a008ac5c3..bcaf604fa542 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -17,6 +17,7 @@
  <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="ssp">protect stack of glibc internals</flag>
+ <flag name="stack-realign">Realign the stack in the 32-bit build for compatibility with older binaries at slight performance cost</flag>
  <flag name="static-pie">Enable static PIE support (runtime files for -static-pie gcc option).</flag>
  <flag name="suid">Make internal pt_chown helper setuid -- not needed if using Linux and have /dev/pts mounted with gid=5</flag>
  <flag name="systemtap">enable systemtap static probe points</flag>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-07-05  4:12 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-07-05  4:12 UTC (permalink / raw
  To: gentoo-commits

commit:     386e65695cf6804a315f1a5f01e7ec29a7faf4b9
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  5 04:11:46 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jul  5 04:12:27 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=386e6569

sys-libs/glibc: 2.35 patchset bump, untested, no keywords

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.35-r8.ebuild | 1604 +++++++++++++++++++++++++++++++++++
 2 files changed, 1605 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 83ff9fc22d84..3ba78c344c4b 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,6 +20,7 @@ DIST glibc-2.35-loongarch-patches-20220522.tar.xz 44728 BLAKE2B 09e7a061f3269ebd
 DIST glibc-2.35-patches-6.tar.xz 57236 BLAKE2B a03845733e2f0ebe179523458695963d729b4211b4ce14310d55163cd33aff502f9e14a4bb0068410777e9b9bb5be4ef7ad1a1fd51debf9191dcf89dc9ff08b8 SHA512 59c5e1669677e969873f5bba38958316a3b32523cac628b97513aed864e191da10499edac77bb5e9a07179d14cf3c75073fd03e8427f7bcfd68fedcedc35083e
 DIST glibc-2.35-patches-7.tar.xz 163840 BLAKE2B 55352eeaf70f74fd8fcd21bd7f3ba14121b496dcfb59e06b5a73be36838dda4b39fc22201c4320c0c38a454c7f1539aae7f3307107e460bede25be33c0525c11 SHA512 d39bb2fecad8cd9213c61e279823f89c3daf9a4f630ac71503df2e9bfb74e019c996bed9a93aaad89083a729a1d3792e7ed8313ac54d757f47d5614ac3469e59
 DIST glibc-2.35-patches-8.tar.xz 178384 BLAKE2B 89ca0ab51f60a25b0d0c00e619f35e71cb18f1794f3656c5e10d87e41f461c43aca51e40f3d8375014d485100098e18f333d3f99888e062f54e632eabd6ebc31 SHA512 cb0945eda142eebb71315b0fcf570e9410acce3b1153fdc3a9148151a7a37624d4cfb91d06ecf20b4045c70051d4c297f0f58f57ba56d9b0a4304b6b7ce2783f
+DIST glibc-2.35-patches-9.tar.xz 183612 BLAKE2B 921664953ed39560ab850754209dbda1f71fbcc5bcc9ec21c187385ea659b90ea055e60961eca266ab3cc81213ed04747aa925dd96a352676fa19d2e63306968 SHA512 24c9ecb6ad890c95bc0e7db3e0c1f20768c728ac0590450fad05aed578623bc33d256d2c4d14a8d8e5c5e9fed7acfab3683053d236f51886cd5a6de93f925ddc
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.35-r8.ebuild b/sys-libs/glibc/glibc-2.35-r8.ebuild
new file mode 100644
index 000000000000..5310e14a026f
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.35-r8.ebuild
@@ -0,0 +1,1604 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# 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 preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=9
+PATCH_DEV=dilfridge
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	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.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 +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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	echo
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-07-06  3:07 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-07-06  3:07 UTC (permalink / raw
  To: gentoo-commits

commit:     f4c3bce90233847b0bc31c4fff5957b9e573ac88
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jul  6 03:06:59 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jul  6 03:07:33 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f4c3bce9

sys-libs/glibc: Re-keyword 2.35-r8 after testing

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r8.ebuild b/sys-libs/glibc/glibc-2.35-r8.ebuild
index 5310e14a026f..3864928751ee 100644
--- a/sys-libs/glibc/glibc-2.35-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-07-28 23:40 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-07-28 23:40 UTC (permalink / raw
  To: gentoo-commits

commit:     c8a3c75d03343bfed4fe082241a559abc7666a20
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 28 23:40:11 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Jul 28 23:40:11 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8a3c75d

sys-libs/glibc: cleanup old

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    4 -
 sys-libs/glibc/glibc-2.35-r4.ebuild | 1596 ----------------------------------
 sys-libs/glibc/glibc-2.35-r5.ebuild | 1596 ----------------------------------
 sys-libs/glibc/glibc-2.35-r6.ebuild | 1597 ----------------------------------
 sys-libs/glibc/glibc-2.35-r7.ebuild | 1604 -----------------------------------
 5 files changed, 6397 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 3ba78c344c4b..fec0aa0ddb1a 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,11 +15,7 @@ DIST glibc-2.33-patches-11.tar.xz 143916 BLAKE2B ac13b3ccf9681bb6d3c35ecc33e268e
 DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb
 DIST glibc-2.34-patches-17.tar.xz 241584 BLAKE2B e4eea130c331f64ba66e14a6ba318853141ee3e41b455cb45b8fdb702cae071dd307229dafcfcafcc41e5a56982f52c87e31d95295f824f1a2ae689a7e0f5b49 SHA512 c6a51b373be3986e1ad753541ccf73f29515b5df0f80e0450b26bed37e8c505e22e8f13e89554347e551819c8d89d30f306464e5d25cafa4a12400c112578dca
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
-DIST glibc-2.35-loongarch-patches-20220422.tar.xz 44804 BLAKE2B b93720e45d23c8d17918ffaa480351499f4748bc08ab6e1f1fd3c681fcc0b08a3381188f5d4f14e6706baa5eb45c787bc635d0e8ea59712514012caf93992222 SHA512 28e2d02f07fcf61f76585dd59627314ed20ebe29ecd7ae7f5aea8db0704482fc024fee744cbee1776e666d14b80b1393f64cd2283e3c39be4c97ebe09efcdee2
 DIST glibc-2.35-loongarch-patches-20220522.tar.xz 44728 BLAKE2B 09e7a061f3269ebd763cd700f7c23e6cd7aab738d87ee31f76a81281920c4e5e207964c79104cd75f0a2e07b77344c2a730a9063344aa1483cd3d9aeac87de40 SHA512 21f13892fb52ec753856d5559b032c2be3a76d1cf940127222f7aa878548ce7e6ea0d2ff8791ddb91aaa2b77ce17131cd2fb2ebbdaa99443bf0a6b4c81f7388d
-DIST glibc-2.35-patches-6.tar.xz 57236 BLAKE2B a03845733e2f0ebe179523458695963d729b4211b4ce14310d55163cd33aff502f9e14a4bb0068410777e9b9bb5be4ef7ad1a1fd51debf9191dcf89dc9ff08b8 SHA512 59c5e1669677e969873f5bba38958316a3b32523cac628b97513aed864e191da10499edac77bb5e9a07179d14cf3c75073fd03e8427f7bcfd68fedcedc35083e
-DIST glibc-2.35-patches-7.tar.xz 163840 BLAKE2B 55352eeaf70f74fd8fcd21bd7f3ba14121b496dcfb59e06b5a73be36838dda4b39fc22201c4320c0c38a454c7f1539aae7f3307107e460bede25be33c0525c11 SHA512 d39bb2fecad8cd9213c61e279823f89c3daf9a4f630ac71503df2e9bfb74e019c996bed9a93aaad89083a729a1d3792e7ed8313ac54d757f47d5614ac3469e59
-DIST glibc-2.35-patches-8.tar.xz 178384 BLAKE2B 89ca0ab51f60a25b0d0c00e619f35e71cb18f1794f3656c5e10d87e41f461c43aca51e40f3d8375014d485100098e18f333d3f99888e062f54e632eabd6ebc31 SHA512 cb0945eda142eebb71315b0fcf570e9410acce3b1153fdc3a9148151a7a37624d4cfb91d06ecf20b4045c70051d4c297f0f58f57ba56d9b0a4304b6b7ce2783f
 DIST glibc-2.35-patches-9.tar.xz 183612 BLAKE2B 921664953ed39560ab850754209dbda1f71fbcc5bcc9ec21c187385ea659b90ea055e60961eca266ab3cc81213ed04747aa925dd96a352676fa19d2e63306968 SHA512 24c9ecb6ad890c95bc0e7db3e0c1f20768c728ac0590450fad05aed578623bc33d256d2c4d14a8d8e5c5e9fed7acfab3683053d236f51886cd5a6de93f925ddc
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238

diff --git a/sys-libs/glibc/glibc-2.35-r4.ebuild b/sys-libs/glibc/glibc-2.35-r4.ebuild
deleted file mode 100644
index 6c6fb048ea14..000000000000
--- a/sys-libs/glibc/glibc-2.35-r4.ebuild
+++ /dev/null
@@ -1,1596 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# 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..10} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=6
-PATCH_DEV=dilfridge
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	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-20220422.tar.xz )"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 +clone3 compile-locales +crypt custom-cflags doc experimental-loong gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	filter-flags '-fstack-protector*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-		use experimental-loong && unpack glibc-2.35-loongarch-patches-20220422.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		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
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	echo
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.35-r5.ebuild b/sys-libs/glibc/glibc-2.35-r5.ebuild
deleted file mode 100644
index 88ec2acf92c1..000000000000
--- a/sys-libs/glibc/glibc-2.35-r5.ebuild
+++ /dev/null
@@ -1,1596 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# 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..10} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=7
-PATCH_DEV=dilfridge
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	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-20220422.tar.xz )"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 +clone3 compile-locales +crypt custom-cflags doc experimental-loong gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	filter-flags '-fstack-protector*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-		use experimental-loong && unpack glibc-2.35-loongarch-patches-20220422.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		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
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	echo
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.35-r6.ebuild b/sys-libs/glibc/glibc-2.35-r6.ebuild
deleted file mode 100644
index 1da6dd8768e4..000000000000
--- a/sys-libs/glibc/glibc-2.35-r6.ebuild
+++ /dev/null
@@ -1,1597 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# 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..10} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=7
-PATCH_DEV=dilfridge
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	KEYWORDS="~loong"
-	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.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 +clone3 compile-locales +crypt custom-cflags doc experimental-loong gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	filter-flags '-fstack-protector*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		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
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	echo
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.35-r7.ebuild b/sys-libs/glibc/glibc-2.35-r7.ebuild
deleted file mode 100644
index 3e8358532526..000000000000
--- a/sys-libs/glibc/glibc-2.35-r7.ebuild
+++ /dev/null
@@ -1,1604 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# 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 preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=8
-PATCH_DEV=dilfridge
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	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.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 +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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	filter-flags '-fstack-protector*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		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
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	echo
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-07-30 23:46 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-07-30 23:46 UTC (permalink / raw
  To: gentoo-commits

commit:     8a8c47ca0010a6a68b81d17328d117338eb015a5
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 30 23:46:09 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jul 30 23:46:09 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8a8c47ca

sys-libs/glibc: Stabilize 2.35-r8 amd64, #856481

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r8.ebuild b/sys-libs/glibc/glibc-2.35-r8.ebuild
index 3864928751ee..3e1cd7475fb5 100644
--- a/sys-libs/glibc/glibc-2.35-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-07-31 11:06 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2022-07-31 11:06 UTC (permalink / raw
  To: gentoo-commits

commit:     5c30978fd01fa0ed28b4a253ea9ffb84fd3629a5
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 31 11:06:02 2022 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Sun Jul 31 11:06:02 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5c30978f

sys-libs/glibc: arm stable wrt bug #856481

Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r8.ebuild b/sys-libs/glibc/glibc-2.35-r8.ebuild
index 3e1cd7475fb5..f506d9e94e33 100644
--- a/sys-libs/glibc/glibc-2.35-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-07-31 11:08 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2022-07-31 11:08 UTC (permalink / raw
  To: gentoo-commits

commit:     d0fe7a04a370fef784cd5379ea48bc56c4ff085c
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 31 11:07:00 2022 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Sun Jul 31 11:07:54 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d0fe7a04

sys-libs/glibc: arm64 stable wrt bug #856481

Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r8.ebuild b/sys-libs/glibc/glibc-2.35-r8.ebuild
index f506d9e94e33..5ff7a32392bf 100644
--- a/sys-libs/glibc/glibc-2.35-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-07-31 11:09 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2022-07-31 11:09 UTC (permalink / raw
  To: gentoo-commits

commit:     4ae705c54bbed5760f16e26ce1e7470ee3fed8b4
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 31 11:08:40 2022 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Sun Jul 31 11:08:40 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4ae705c5

sys-libs/glibc: ppc stable wrt bug #856481

Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r8.ebuild b/sys-libs/glibc/glibc-2.35-r8.ebuild
index 5ff7a32392bf..2f7f254cf14a 100644
--- a/sys-libs/glibc/glibc-2.35-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-07-31 11:10 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2022-07-31 11:10 UTC (permalink / raw
  To: gentoo-commits

commit:     11821df405ebc895ef03f03bea117beb32ca5180
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 31 11:09:29 2022 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Sun Jul 31 11:09:29 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=11821df4

sys-libs/glibc: ppc64 stable wrt bug #856481

Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r8.ebuild b/sys-libs/glibc/glibc-2.35-r8.ebuild
index 2f7f254cf14a..3131022db230 100644
--- a/sys-libs/glibc/glibc-2.35-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-07-31 11:11 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2022-07-31 11:11 UTC (permalink / raw
  To: gentoo-commits

commit:     386e855481e375d93c64e361475a1cdceb13c501
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 31 11:10:50 2022 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Sun Jul 31 11:10:50 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=386e8554

sys-libs/glibc: sparc stable wrt bug #856481

Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r8.ebuild b/sys-libs/glibc/glibc-2.35-r8.ebuild
index 3131022db230..7f9f7104a0e6 100644
--- a/sys-libs/glibc/glibc-2.35-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-08-01  8:05 Agostino Sarubbo
  0 siblings, 0 replies; 1076+ messages in thread
From: Agostino Sarubbo @ 2022-08-01  8:05 UTC (permalink / raw
  To: gentoo-commits

commit:     cfdd1193f34fa07e0589d1e61978a66ad633dff2
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  1 08:05:14 2022 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Mon Aug  1 08:05:14 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cfdd1193

sys-libs/glibc: x86 stable wrt bug #856481

Signed-off-by: Agostino Sarubbo <ago <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r8.ebuild b/sys-libs/glibc/glibc-2.35-r8.ebuild
index 7f9f7104a0e6..c50c5ba3fbca 100644
--- a/sys-libs/glibc/glibc-2.35-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-08-02 21:12 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-08-02 21:12 UTC (permalink / raw
  To: gentoo-commits

commit:     ac949ee5b72bc799894d221fd3d35e8466fa635d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  2 21:12:14 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Aug  2 21:12:41 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ac949ee5

sys-libs/glibc: version bump 2.36, no keywords

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          |    2 +
 sys-libs/glibc/glibc-2.36.ebuild | 1602 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 1604 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index fec0aa0ddb1a..7419fbc534a9 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,6 +18,8 @@ DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8
 DIST glibc-2.35-loongarch-patches-20220522.tar.xz 44728 BLAKE2B 09e7a061f3269ebd763cd700f7c23e6cd7aab738d87ee31f76a81281920c4e5e207964c79104cd75f0a2e07b77344c2a730a9063344aa1483cd3d9aeac87de40 SHA512 21f13892fb52ec753856d5559b032c2be3a76d1cf940127222f7aa878548ce7e6ea0d2ff8791ddb91aaa2b77ce17131cd2fb2ebbdaa99443bf0a6b4c81f7388d
 DIST glibc-2.35-patches-9.tar.xz 183612 BLAKE2B 921664953ed39560ab850754209dbda1f71fbcc5bcc9ec21c187385ea659b90ea055e60961eca266ab3cc81213ed04747aa925dd96a352676fa19d2e63306968 SHA512 24c9ecb6ad890c95bc0e7db3e0c1f20768c728ac0590450fad05aed578623bc33d256d2c4d14a8d8e5c5e9fed7acfab3683053d236f51886cd5a6de93f925ddc
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
+DIST glibc-2.36-patches-1.tar.xz 16204 BLAKE2B f5d2700daf112b3bcb5c84db946e21d8f3c0c8138ef0a2054b42757d42374375627d326443525f5765dbfa2e97095f2cb13a98c5f97527cf50d234c824d5585c SHA512 b82763064972aff88a28e5a4518a8ef18db0ec273408d1c00f0d620421457155e340a85abcbdcc9b477e5e48f841113589ee056b5a54c6c83cd4dbc633d7cb49
+DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff

diff --git a/sys-libs/glibc/glibc-2.36.ebuild b/sys-libs/glibc/glibc-2.36.ebuild
new file mode 100644
index 000000000000..b35b2febd192
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.36.ebuild
@@ -0,0 +1,1602 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# 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 preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=1
+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=""
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	echo
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-08-07  8:02 WANG Xuerui
  0 siblings, 0 replies; 1076+ messages in thread
From: WANG Xuerui @ 2022-08-07  8:02 UTC (permalink / raw
  To: gentoo-commits

commit:     8aefd7f6e791814c5647dfeb15ac2e723848d16c
Author:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
AuthorDate: Sun Aug  7 05:28:29 2022 +0000
Commit:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
CommitDate: Sun Aug  7 08:02:38 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8aefd7f6

sys-libs/glibc: keyword 2.36 for ~loong

Contrary to the other arches, loong is effectively on 2.36 from day one,
also the current userbase is small and tech-savvy enough for us to just
switch and enable more early testing and feedback.

Signed-off-by: WANG Xuerui <xen0n <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36.ebuild b/sys-libs/glibc/glibc-2.36.ebuild
index b35b2febd192..df09f5c97b9d 100644
--- a/sys-libs/glibc/glibc-2.36.ebuild
+++ b/sys-libs/glibc/glibc-2.36.ebuild
@@ -27,7 +27,7 @@ if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
 	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	KEYWORDS=""
+	KEYWORDS="~loong"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-08-20  0:32 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-08-20  0:32 UTC (permalink / raw
  To: gentoo-commits

commit:     4fd2400c18a36b8aad51328b3731fef55968e4fc
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 20 00:31:21 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Aug 20 00:32:36 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4fd2400c

sys-libs/glibc: restore GCC < 11.2.1_p* AVX512 sanity check

It's cheap and it avoids build failures, so why not?

Only really affects Tiger Lake or so though. Fixed
in newer GCCs anyway.

Bug: https://bugs.gentoo.org/823780
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r8.ebuild | 6 ++++++
 sys-libs/glibc/glibc-2.36.ebuild    | 6 ++++++
 sys-libs/glibc/glibc-9999.ebuild    | 6 ++++++
 3 files changed, 18 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.35-r8.ebuild b/sys-libs/glibc/glibc-2.35-r8.ebuild
index c50c5ba3fbca..25a735d93196 100644
--- a/sys-libs/glibc/glibc-2.35-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r8.ebuild
@@ -326,6 +326,12 @@ setup_target_flags() {
 				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)

diff --git a/sys-libs/glibc/glibc-2.36.ebuild b/sys-libs/glibc/glibc-2.36.ebuild
index df09f5c97b9d..dc52203e0fe7 100644
--- a/sys-libs/glibc/glibc-2.36.ebuild
+++ b/sys-libs/glibc/glibc-2.36.ebuild
@@ -326,6 +326,12 @@ setup_target_flags() {
 				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)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index b35b2febd192..92b54a5a254a 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -326,6 +326,12 @@ setup_target_flags() {
 				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)


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-08-20  0:59 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-08-20  0:59 UTC (permalink / raw
  To: gentoo-commits

commit:     77cec48da70c6d6424ed6dba4357dd8eacd262c2
Author:     Adrian Ratiu <adrian.ratiu <AT> collabora <DOT> com>
AuthorDate: Fri Aug  5 12:41:45 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Aug 20 00:58:58 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=77cec48d

sys-libs/glibc: make crypt.h install depend on crypt use flag

The crypt use flag is supposed to control whether libcrypt
and its associated crypt.h are installed, but it's ignored
in header-only builds and crypt.h is always installed.

This generates a conflict for eg with sys-libs/libcxrypt
installed as a system lib which provides /usr/include/crypt.h
even if glibc is built with -crypt.

The solution is for glibc to properly respect the crypt
use flag when installing the headers.

Fixes: https://bugs.gentoo.org/863812
Signed-off-by: Adrian Ratiu <adrian.ratiu <AT> collabora.com>
Closes: https://github.com/gentoo/gentoo/pull/26747
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/{glibc-2.33-r13.ebuild => glibc-2.33-r14.ebuild} | 1 +
 sys-libs/glibc/{glibc-2.34-r13.ebuild => glibc-2.34-r14.ebuild} | 1 +
 sys-libs/glibc/glibc-2.35-r8.ebuild                             | 1 +
 sys-libs/glibc/glibc-2.36.ebuild                                | 1 +
 sys-libs/glibc/glibc-9999.ebuild                                | 1 +
 5 files changed, 5 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.33-r13.ebuild b/sys-libs/glibc/glibc-2.33-r14.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.33-r13.ebuild
rename to sys-libs/glibc/glibc-2.33-r14.ebuild
index 9fd5d468641c..98877549d384 100644
--- a/sys-libs/glibc/glibc-2.33-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r14.ebuild
@@ -1131,6 +1131,7 @@ glibc_headers_configure() {
 		--host=${CTARGET_OPT:-${CTARGET}}
 		--with-headers=$(build_eprefix)$(alt_build_headers)
 		--prefix="$(host_eprefix)/usr"
+		$(use_enable crypt)
 		${EXTRA_ECONF}
 	)
 

diff --git a/sys-libs/glibc/glibc-2.34-r13.ebuild b/sys-libs/glibc/glibc-2.34-r14.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.34-r13.ebuild
rename to sys-libs/glibc/glibc-2.34-r14.ebuild
index 1cd002c9c54a..454796952613 100644
--- a/sys-libs/glibc/glibc-2.34-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r14.ebuild
@@ -1149,6 +1149,7 @@ glibc_headers_configure() {
 		--host=${CTARGET_OPT:-${CTARGET}}
 		--with-headers=$(build_eprefix)$(alt_build_headers)
 		--prefix="$(host_eprefix)/usr"
+		$(use_enable crypt)
 		${EXTRA_ECONF}
 	)
 

diff --git a/sys-libs/glibc/glibc-2.35-r8.ebuild b/sys-libs/glibc/glibc-2.35-r8.ebuild
index 25a735d93196..9ae33c6fc9d5 100644
--- a/sys-libs/glibc/glibc-2.35-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r8.ebuild
@@ -1142,6 +1142,7 @@ glibc_headers_configure() {
 		--host=${CTARGET_OPT:-${CTARGET}}
 		--with-headers=$(build_eprefix)$(alt_build_headers)
 		--prefix="$(host_eprefix)/usr"
+		$(use_enable crypt)
 		${EXTRA_ECONF}
 	)
 

diff --git a/sys-libs/glibc/glibc-2.36.ebuild b/sys-libs/glibc/glibc-2.36.ebuild
index dc52203e0fe7..1ef2d277f251 100644
--- a/sys-libs/glibc/glibc-2.36.ebuild
+++ b/sys-libs/glibc/glibc-2.36.ebuild
@@ -1140,6 +1140,7 @@ glibc_headers_configure() {
 		--host=${CTARGET_OPT:-${CTARGET}}
 		--with-headers=$(build_eprefix)$(alt_build_headers)
 		--prefix="$(host_eprefix)/usr"
+		$(use_enable crypt)
 		${EXTRA_ECONF}
 	)
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 92b54a5a254a..6797fdf6cd8a 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1140,6 +1140,7 @@ glibc_headers_configure() {
 		--host=${CTARGET_OPT:-${CTARGET}}
 		--with-headers=$(build_eprefix)$(alt_build_headers)
 		--prefix="$(host_eprefix)/usr"
+		$(use_enable crypt)
 		${EXTRA_ECONF}
 	)
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-08-27 18:05 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-08-27 18:05 UTC (permalink / raw
  To: gentoo-commits

commit:     56ab3ee13fbd12a2a73d2f69d5fd2dd514b9aaff
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 27 18:05:36 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Aug 27 18:05:36 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=56ab3ee1

sys-libs/glibc: Stabilize 2.35-r8 hppa, #856481

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r8.ebuild b/sys-libs/glibc/glibc-2.35-r8.ebuild
index 9ae33c6fc9d5..5ae1d9a6d0ae 100644
--- a/sys-libs/glibc/glibc-2.35-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-08-27 19:36 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-08-27 19:36 UTC (permalink / raw
  To: gentoo-commits

commit:     c428e1c9fd3325c241f7d6228730c6268ea791d7
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 27 19:35:34 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Aug 27 19:36:31 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c428e1c9

sys-libs/glibc: 2.36 patchset bump

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest                                    | 2 +-
 sys-libs/glibc/{glibc-2.36.ebuild => glibc-2.36-r1.ebuild} | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 7419fbc534a9..8081854a5460 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,7 +18,7 @@ DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8
 DIST glibc-2.35-loongarch-patches-20220522.tar.xz 44728 BLAKE2B 09e7a061f3269ebd763cd700f7c23e6cd7aab738d87ee31f76a81281920c4e5e207964c79104cd75f0a2e07b77344c2a730a9063344aa1483cd3d9aeac87de40 SHA512 21f13892fb52ec753856d5559b032c2be3a76d1cf940127222f7aa878548ce7e6ea0d2ff8791ddb91aaa2b77ce17131cd2fb2ebbdaa99443bf0a6b4c81f7388d
 DIST glibc-2.35-patches-9.tar.xz 183612 BLAKE2B 921664953ed39560ab850754209dbda1f71fbcc5bcc9ec21c187385ea659b90ea055e60961eca266ab3cc81213ed04747aa925dd96a352676fa19d2e63306968 SHA512 24c9ecb6ad890c95bc0e7db3e0c1f20768c728ac0590450fad05aed578623bc33d256d2c4d14a8d8e5c5e9fed7acfab3683053d236f51886cd5a6de93f925ddc
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
-DIST glibc-2.36-patches-1.tar.xz 16204 BLAKE2B f5d2700daf112b3bcb5c84db946e21d8f3c0c8138ef0a2054b42757d42374375627d326443525f5765dbfa2e97095f2cb13a98c5f97527cf50d234c824d5585c SHA512 b82763064972aff88a28e5a4518a8ef18db0ec273408d1c00f0d620421457155e340a85abcbdcc9b477e5e48f841113589ee056b5a54c6c83cd4dbc633d7cb49
+DIST glibc-2.36-patches-2.tar.xz 27096 BLAKE2B a7b6ead31476980a3e5851d060249184b7ad75faa2bec8b07fc1a45899eb81a983ab354514d8dd2c0a4c53b83c54587e7e982a9fece8354894f0f9f96c675368 SHA512 fb09cc4d7e96303322953bd597e30d1bf6ce17efd27d678d78addf18bf8fdeac7ad6c9313d15c17c71df99c0ea4f66aad2333365784caf6f381d26ccdfd186a8
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.36.ebuild b/sys-libs/glibc/glibc-2.36-r1.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.36.ebuild
rename to sys-libs/glibc/glibc-2.36-r1.ebuild
index 1ef2d277f251..5ca8bd820bbd 100644
--- a/sys-libs/glibc/glibc-2.36.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r1.ebuild
@@ -20,7 +20,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=1
+PATCH_VER=2
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-09-03 20:38 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-09-03 20:38 UTC (permalink / raw
  To: gentoo-commits

commit:     e518609a556e79cc677c550a91f35f8f12e80e39
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  3 20:36:48 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Sep  3 20:36:48 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e518609a

sys-libs/glibc: Add 2.35 version patched for m68k alignment bug

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29537
Bug: https://gitlab.com/qemu-project/qemu/-/issues/957
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.35-r9.ebuild | 1612 +++++++++++++++++++++++++++++++++++
 2 files changed, 1613 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 8081854a5460..621065df2a0c 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,6 +16,7 @@ DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d91116
 DIST glibc-2.34-patches-17.tar.xz 241584 BLAKE2B e4eea130c331f64ba66e14a6ba318853141ee3e41b455cb45b8fdb702cae071dd307229dafcfcafcc41e5a56982f52c87e31d95295f824f1a2ae689a7e0f5b49 SHA512 c6a51b373be3986e1ad753541ccf73f29515b5df0f80e0450b26bed37e8c505e22e8f13e89554347e551819c8d89d30f306464e5d25cafa4a12400c112578dca
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 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-patches-9.tar.xz 183612 BLAKE2B 921664953ed39560ab850754209dbda1f71fbcc5bcc9ec21c187385ea659b90ea055e60961eca266ab3cc81213ed04747aa925dd96a352676fa19d2e63306968 SHA512 24c9ecb6ad890c95bc0e7db3e0c1f20768c728ac0590450fad05aed578623bc33d256d2c4d14a8d8e5c5e9fed7acfab3683053d236f51886cd5a6de93f925ddc
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-2.36-patches-2.tar.xz 27096 BLAKE2B a7b6ead31476980a3e5851d060249184b7ad75faa2bec8b07fc1a45899eb81a983ab354514d8dd2c0a4c53b83c54587e7e982a9fece8354894f0f9f96c675368 SHA512 fb09cc4d7e96303322953bd597e30d1bf6ce17efd27d678d78addf18bf8fdeac7ad6c9313d15c17c71df99c0ea4f66aad2333365784caf6f381d26ccdfd186a8

diff --git a/sys-libs/glibc/glibc-2.35-r9.ebuild b/sys-libs/glibc/glibc-2.35-r9.ebuild
new file mode 100644
index 000000000000..1ade69984747
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.35-r9.ebuild
@@ -0,0 +1,1612 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# 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 preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=10
+PATCH_DEV=dilfridge
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	# 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.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 +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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+
+	local v
+	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
+
+	echo
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-09-09 20:32 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-09-09 20:32 UTC (permalink / raw
  To: gentoo-commits

commit:     9b652cb9bca9c59fd7e7e6c95411f8f8bb596b82
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  9 20:32:02 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep  9 20:32:02 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9b652cb9

sys-libs/glibc: Bump 2.35 patchlevel, new m68k patch

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest                                        | 2 +-
 sys-libs/glibc/{glibc-2.35-r9.ebuild => glibc-2.35-r10.ebuild} | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 621065df2a0c..5daf09e7c42c 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,7 +16,7 @@ DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d91116
 DIST glibc-2.34-patches-17.tar.xz 241584 BLAKE2B e4eea130c331f64ba66e14a6ba318853141ee3e41b455cb45b8fdb702cae071dd307229dafcfcafcc41e5a56982f52c87e31d95295f824f1a2ae689a7e0f5b49 SHA512 c6a51b373be3986e1ad753541ccf73f29515b5df0f80e0450b26bed37e8c505e22e8f13e89554347e551819c8d89d30f306464e5d25cafa4a12400c112578dca
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 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-patches-11.tar.xz 222648 BLAKE2B e4c9c9cd033a02183645993af112df20207de8fc51e8f889a567cea1e688dff5d95916a59c6184c0c8c8ca4958b33ba1748cb75185deeae3e15be5eeb49255c7 SHA512 db14b78a50a4fe537a082c8f596a30516b2d5e26958baee65e165e627efdd0e0d6df9393fbfd04062a3fa6f66ef3f9aac4981ffb4f644ef561417c743bbc8a3e
 DIST glibc-2.35-patches-9.tar.xz 183612 BLAKE2B 921664953ed39560ab850754209dbda1f71fbcc5bcc9ec21c187385ea659b90ea055e60961eca266ab3cc81213ed04747aa925dd96a352676fa19d2e63306968 SHA512 24c9ecb6ad890c95bc0e7db3e0c1f20768c728ac0590450fad05aed578623bc33d256d2c4d14a8d8e5c5e9fed7acfab3683053d236f51886cd5a6de93f925ddc
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-2.36-patches-2.tar.xz 27096 BLAKE2B a7b6ead31476980a3e5851d060249184b7ad75faa2bec8b07fc1a45899eb81a983ab354514d8dd2c0a4c53b83c54587e7e982a9fece8354894f0f9f96c675368 SHA512 fb09cc4d7e96303322953bd597e30d1bf6ce17efd27d678d78addf18bf8fdeac7ad6c9313d15c17c71df99c0ea4f66aad2333365784caf6f381d26ccdfd186a8

diff --git a/sys-libs/glibc/glibc-2.35-r9.ebuild b/sys-libs/glibc/glibc-2.35-r10.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.35-r9.ebuild
rename to sys-libs/glibc/glibc-2.35-r10.ebuild
index 1ade69984747..b82f5d853149 100644
--- a/sys-libs/glibc/glibc-2.35-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r10.ebuild
@@ -20,7 +20,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=10
+PATCH_VER=11
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-09-18 15:51 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-09-18 15:51 UTC (permalink / raw
  To: gentoo-commits

commit:     18bf1fb6e19dbb1889e7adc615f80c325cd3b060
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 18 15:50:17 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Sep 18 15:50:17 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=18bf1fb6

sys-libs/glibc: Rekeyword 2.35-r10 on all arches

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r10.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.35-r10.ebuild b/sys-libs/glibc/glibc-2.35-r10.ebuild
index b82f5d853149..9304559b29e4 100644
--- a/sys-libs/glibc/glibc-2.35-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r10.ebuild
@@ -26,8 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	KEYWORDS="~m68k"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-09-20  6:37 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-09-20  6:37 UTC (permalink / raw
  To: gentoo-commits

commit:     6e4b8436556f5fddf64c7ceea975915bb4604eaa
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 20 06:36:51 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Sep 20 06:37:40 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6e4b8436

sys-libs/glibc: 2.36 patchset bump

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest                                       | 2 +-
 sys-libs/glibc/{glibc-2.36-r1.ebuild => glibc-2.36-r2.ebuild} | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 5daf09e7c42c..8f526578d263 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,7 +19,7 @@ DIST glibc-2.35-loongarch-patches-20220522.tar.xz 44728 BLAKE2B 09e7a061f3269ebd
 DIST glibc-2.35-patches-11.tar.xz 222648 BLAKE2B e4c9c9cd033a02183645993af112df20207de8fc51e8f889a567cea1e688dff5d95916a59c6184c0c8c8ca4958b33ba1748cb75185deeae3e15be5eeb49255c7 SHA512 db14b78a50a4fe537a082c8f596a30516b2d5e26958baee65e165e627efdd0e0d6df9393fbfd04062a3fa6f66ef3f9aac4981ffb4f644ef561417c743bbc8a3e
 DIST glibc-2.35-patches-9.tar.xz 183612 BLAKE2B 921664953ed39560ab850754209dbda1f71fbcc5bcc9ec21c187385ea659b90ea055e60961eca266ab3cc81213ed04747aa925dd96a352676fa19d2e63306968 SHA512 24c9ecb6ad890c95bc0e7db3e0c1f20768c728ac0590450fad05aed578623bc33d256d2c4d14a8d8e5c5e9fed7acfab3683053d236f51886cd5a6de93f925ddc
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
-DIST glibc-2.36-patches-2.tar.xz 27096 BLAKE2B a7b6ead31476980a3e5851d060249184b7ad75faa2bec8b07fc1a45899eb81a983ab354514d8dd2c0a4c53b83c54587e7e982a9fece8354894f0f9f96c675368 SHA512 fb09cc4d7e96303322953bd597e30d1bf6ce17efd27d678d78addf18bf8fdeac7ad6c9313d15c17c71df99c0ea4f66aad2333365784caf6f381d26ccdfd186a8
+DIST glibc-2.36-patches-3.tar.xz 67004 BLAKE2B 185180e113c7aa257b9798577c4f7d80eea169efb02c8a91b203cad1cd65cc51b35e66cf9106978efd0d0c03c834e51e348f27097a04290aed7fec1158c7bc56 SHA512 704cca2d3aaa75694600af6e3aeb20fbebe97f6a03036334382cfd6752dfa0a091d772d350b085907a0722c53aac6fccd9df320ec2d4cd303eba36a3c0e0f39b
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.36-r1.ebuild b/sys-libs/glibc/glibc-2.36-r2.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.36-r1.ebuild
rename to sys-libs/glibc/glibc-2.36-r2.ebuild
index 3b5e0a61d825..665006b33b60 100644
--- a/sys-libs/glibc/glibc-2.36-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r2.ebuild
@@ -20,7 +20,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=2
+PATCH_VER=3
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-09-20 14:46 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-09-20 14:46 UTC (permalink / raw
  To: gentoo-commits

commit:     75742d424da6fda615d319f1668009945f30c4f6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 20 14:46:20 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Sep 20 14:46:38 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=75742d42

sys-libs/glibc: drop duplicate patch in 2.36-r1

It's in the patchset now.

Closes: https://bugs.gentoo.org/872056
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r2.ebuild | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.36-r2.ebuild b/sys-libs/glibc/glibc-2.36-r2.ebuild
index 665006b33b60..e1c6f02520cb 100644
--- a/sys-libs/glibc/glibc-2.36-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r2.ebuild
@@ -888,8 +888,6 @@ src_prepare() {
 		einfo "Done."
 	fi
 
-	eapply "${FILESDIR}"/2.35/glibc-2.35-make-4.4-MAKEFLAGS.patch
-
 	default
 
 	gnuconfig_update


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-09-20 20:20 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-09-20 20:20 UTC (permalink / raw
  To: gentoo-commits

commit:     482fa96f4ed12c6c5fdb8c6aea17340136ecbdac
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 20 20:18:51 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Sep 20 20:20:17 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=482fa96f

sys-libs/glibc: Introduce useflag hash-sysv-compat, untested so far

Bug: https://bugs.gentoo.org/864100
Bug: https://bugs.gentoo.org/863863
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/{glibc-9999.ebuild => glibc-2.36-r3.ebuild} | 12 +++++++++---
 sys-libs/glibc/glibc-9999.ebuild                           |  8 +++++++-
 sys-libs/glibc/metadata.xml                                |  1 +
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.36-r3.ebuild
similarity index 98%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.36-r3.ebuild
index 6797fdf6cd8a..5e0dceed3be4 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r3.ebuild
@@ -20,13 +20,13 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=1
+PATCH_VER=3
 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=""
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
@@ -44,7 +44,7 @@ SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${L
 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 stack-realign +static-libs suid systemd systemtap test vanilla"
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd hash-sysv-compat 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"
@@ -418,6 +418,12 @@ setup_flags() {
 	# https://sourceware.org/PR27837
 	filter-ldflags '-Wl,--relax'
 
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
 	# #492892
 	filter-flags -frecord-gcc-switches
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 6797fdf6cd8a..68785ea5f6e6 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -44,7 +44,7 @@ SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${L
 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 stack-realign +static-libs suid systemd systemtap test vanilla"
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd hash-sysv-compat 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"
@@ -418,6 +418,12 @@ setup_flags() {
 	# https://sourceware.org/PR27837
 	filter-ldflags '-Wl,--relax'
 
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
 	# #492892
 	filter-flags -frecord-gcc-switches
 

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index eb25b52087e2..69c29b299aab 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -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="experimental-loong">Add experimental LoongArch patchset</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="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>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-09-22  6:45 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-09-22  6:45 UTC (permalink / raw
  To: gentoo-commits

commit:     c05dafb11ab3241e51646ae4f7a915c88182d10d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 22 06:41:59 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Sep 22 06:44:56 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c05dafb1

sys-libs/glibc: Re-keyword 2.36

Bug: https://bugs.gentoo.org/863215
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r3.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.36-r3.ebuild b/sys-libs/glibc/glibc-2.36-r3.ebuild
index 5e0dceed3be4..1c3abc020acc 100644
--- a/sys-libs/glibc/glibc-2.36-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r3.ebuild
@@ -26,8 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	KEYWORDS=""
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-09-23 15:30 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-09-23 15:30 UTC (permalink / raw
  To: gentoo-commits

commit:     98d14046ff3cc3fc6ddf9cc45a70d185b5c36bfe
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 23 15:29:44 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep 23 15:30:27 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=98d14046

sys-libs/glibc: Add CPP to list of variables reset in clang profiles

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r10.ebuild | 1 +
 sys-libs/glibc/glibc-2.35-r8.ebuild  | 1 +
 sys-libs/glibc/glibc-2.36-r3.ebuild  | 1 +
 sys-libs/glibc/glibc-9999.ebuild     | 1 +
 4 files changed, 4 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.35-r10.ebuild b/sys-libs/glibc/glibc-2.35-r10.ebuild
index c07be651ccb0..50faea777545 100644
--- a/sys-libs/glibc/glibc-2.35-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r10.ebuild
@@ -537,6 +537,7 @@ setup_env() {
 		einfo "Overriding clang configuration, since it won't work here"
 
 		export CC="${current_gcc_path}/gcc"
+		export CPP="${current_gcc_path}/cpp"
 		export CXX="${current_gcc_path}/g++"
 		export LD="${current_binutils_path}/ld.bfd"
 		export AR="${current_binutils_path}/ar"

diff --git a/sys-libs/glibc/glibc-2.35-r8.ebuild b/sys-libs/glibc/glibc-2.35-r8.ebuild
index 5ae1d9a6d0ae..4c73a826a4a7 100644
--- a/sys-libs/glibc/glibc-2.35-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r8.ebuild
@@ -537,6 +537,7 @@ setup_env() {
 		einfo "Overriding clang configuration, since it won't work here"
 
 		export CC="${current_gcc_path}/gcc"
+		export CPP="${current_gcc_path}/cpp"
 		export CXX="${current_gcc_path}/g++"
 		export LD="${current_binutils_path}/ld.bfd"
 		export AR="${current_binutils_path}/ar"

diff --git a/sys-libs/glibc/glibc-2.36-r3.ebuild b/sys-libs/glibc/glibc-2.36-r3.ebuild
index 1c3abc020acc..f9e61a195f5b 100644
--- a/sys-libs/glibc/glibc-2.36-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r3.ebuild
@@ -547,6 +547,7 @@ setup_env() {
 		einfo "Overriding clang configuration, since it won't work here"
 
 		export CC="${current_gcc_path}/gcc"
+		export CPP="${current_gcc_path}/cpp"
 		export CXX="${current_gcc_path}/g++"
 		export LD="${current_binutils_path}/ld.bfd"
 		export AR="${current_binutils_path}/ar"

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 68785ea5f6e6..7274cb4d125d 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -548,6 +548,7 @@ setup_env() {
 		einfo "Overriding clang configuration, since it won't work here"
 
 		export CC="${current_gcc_path}/gcc"
+		export CPP="${current_gcc_path}/cpp"
 		export CXX="${current_gcc_path}/g++"
 		export LD="${current_binutils_path}/ld.bfd"
 		export AR="${current_binutils_path}/ar"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-09-23 15:31 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-09-23 15:31 UTC (permalink / raw
  To: gentoo-commits

commit:     689b2e3a33d2da52a8288cc0e548bea8f66e68f5
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 23 15:31:35 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep 23 15:31:35 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=689b2e3a

sys-libs/glibc: Remove old

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r2.ebuild | 1609 -----------------------------------
 1 file changed, 1609 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.36-r2.ebuild b/sys-libs/glibc/glibc-2.36-r2.ebuild
deleted file mode 100644
index e1c6f02520cb..000000000000
--- a/sys-libs/glibc/glibc-2.36-r2.ebuild
+++ /dev/null
@@ -1,1609 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# 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 preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=3
-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="~loong"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	echo
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-09-23 20:00 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-09-23 20:00 UTC (permalink / raw
  To: gentoo-commits

commit:     ac0221cf76daa68f3acff74185e7afde7adfe9a6
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 23 20:00:00 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep 23 20:00:24 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ac0221cf

sys-libs/glibc: Fix variable names

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r3.ebuild | 20 ++++++++++----------
 sys-libs/glibc/glibc-9999.ebuild    | 20 ++++++++++----------
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.36-r3.ebuild b/sys-libs/glibc/glibc-2.36-r3.ebuild
index f9e61a195f5b..d6ff07ee05da 100644
--- a/sys-libs/glibc/glibc-2.36-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r3.ebuild
@@ -522,12 +522,12 @@ setup_env() {
 	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})}}
+	export CC=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__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}
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
 
 	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
 
@@ -585,10 +585,10 @@ setup_env() {
 	# around the original clean value to avoid appending multiple ABIs on
 	# 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 glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
 
-	export __abi_CFLAGS="$(get_abi_CFLAGS)"
+	export glibc__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
@@ -597,10 +597,10 @@ setup_env() {
 	# 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}"
+	export CC="${glibc__GLIBC_CC} ${glibc__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}"
+	export CXX="${glibc__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
 
 	if is_crosscompile; then
 		# Assume worst-case bootstrap: glibc is buil first time

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 7274cb4d125d..6330ccf1997a 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -523,12 +523,12 @@ setup_env() {
 	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})}}
+	export CC=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__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}
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
 
 	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
 
@@ -586,10 +586,10 @@ setup_env() {
 	# around the original clean value to avoid appending multiple ABIs on
 	# 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 glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
 
-	export __abi_CFLAGS="$(get_abi_CFLAGS)"
+	export glibc__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
@@ -598,10 +598,10 @@ setup_env() {
 	# 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}"
+	export CC="${glibc__GLIBC_CC} ${glibc__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}"
+	export CXX="${glibc__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
 
 	if is_crosscompile; then
 		# Assume worst-case bootstrap: glibc is buil first time


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-09-23 20:07 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-09-23 20:07 UTC (permalink / raw
  To: gentoo-commits

commit:     b7b3151057b6736a3d9477bec942379b0c6b460c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 23 20:07:24 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep 23 20:07:45 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b7b31510

sys-libs/glibc: Simplify environment output

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r10.ebuild | 16 ++++++++++------
 sys-libs/glibc/glibc-2.36-r3.ebuild  | 16 ++++++++++------
 sys-libs/glibc/glibc-9999.ebuild     | 16 ++++++++++------
 3 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.35-r10.ebuild b/sys-libs/glibc/glibc-2.35-r10.ebuild
index 50faea777545..0395750a45d4 100644
--- a/sys-libs/glibc/glibc-2.35-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r10.ebuild
@@ -183,6 +183,15 @@ XFAIL_TEST_LIST=(
 # Small helper functions
 #
 
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
 is_crosscompile() {
 	[[ ${CHOST} != ${CTARGET} ]]
 }
@@ -913,13 +922,8 @@ src_prepare() {
 }
 
 glibc_do_configure() {
+	dump_build_environment
 
-	local v
-	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
-
-	echo
 	local myconf=()
 
 	# Use '=strong' instead of '=all' to protect only functions

diff --git a/sys-libs/glibc/glibc-2.36-r3.ebuild b/sys-libs/glibc/glibc-2.36-r3.ebuild
index d6ff07ee05da..4910c60fc2c5 100644
--- a/sys-libs/glibc/glibc-2.36-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r3.ebuild
@@ -182,6 +182,15 @@ XFAIL_TEST_LIST=(
 # Small helper functions
 #
 
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
 is_crosscompile() {
 	[[ ${CHOST} != ${CTARGET} ]]
 }
@@ -914,13 +923,8 @@ src_prepare() {
 }
 
 glibc_do_configure() {
+	dump_build_environment
 
-	local v
-	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
-
-	echo
 	local myconf=()
 
 	# Use '=strong' instead of '=all' to protect only functions

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 6330ccf1997a..a2e792581064 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -183,6 +183,15 @@ XFAIL_TEST_LIST=(
 # Small helper functions
 #
 
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
 is_crosscompile() {
 	[[ ${CHOST} != ${CTARGET} ]]
 }
@@ -915,13 +924,8 @@ src_prepare() {
 }
 
 glibc_do_configure() {
+	dump_build_environment
 
-	local v
-	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
-
-	echo
 	local myconf=()
 
 	# Use '=strong' instead of '=all' to protect only functions


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-09-23 20:25 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-09-23 20:25 UTC (permalink / raw
  To: gentoo-commits

commit:     a9886972c64a836852369c5fabe4581bbc7402e0
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 23 20:24:30 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep 23 20:25:13 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a9886972

sys-libs/glibc: Remember across phases if we need to force gcc

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r10.ebuild | 5 +++++
 sys-libs/glibc/glibc-2.36-r3.ebuild  | 5 +++++
 sys-libs/glibc/glibc-9999.ebuild     | 5 +++++
 3 files changed, 15 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.35-r10.ebuild b/sys-libs/glibc/glibc-2.35-r10.ebuild
index 0395750a45d4..bf55284796ae 100644
--- a/sys-libs/glibc/glibc-2.35-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r10.ebuild
@@ -529,7 +529,12 @@ setup_env() {
 	export __ORIG_CXX=${CXX}
 
 	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
 
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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

diff --git a/sys-libs/glibc/glibc-2.36-r3.ebuild b/sys-libs/glibc/glibc-2.36-r3.ebuild
index 4910c60fc2c5..012d6984dd74 100644
--- a/sys-libs/glibc/glibc-2.36-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r3.ebuild
@@ -539,7 +539,12 @@ setup_env() {
 	export glibc__ORIG_CXX=${CXX}
 
 	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
 
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a2e792581064..8456c2a16fe4 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -540,7 +540,12 @@ setup_env() {
 	export glibc__ORIG_CXX=${CXX}
 
 	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
 
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-09-25  1:21 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-09-25  1:21 UTC (permalink / raw
  To: gentoo-commits

commit:     8e62898af68131da0430c09cd99955d3eef1567c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  9 14:23:43 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Sep 25 01:19:02 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8e62898a

sys-libs/glibc: avoid gcc-major-version failure

I ended up getting a weird failure (which I can't reproduce any longer,
but it maeks sense still I think):
```
x86_64-pc-linux-gnu-gcc -m64 -pipe -march=native -fdiagnostics-color=always -ggdb3 -O2 -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-z,pack-relative-relocs -fuse-ld=bfd -Wl,-O1 -Wl,--as-needed -pipe -march=native -fdiagnostics-color=always -ggdb3 -O2 -m32  -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-z,pack-relative-relocs -fuse-ld=bfd -Wl,-O1 -Wl,--as-needed  glibc-test.c   -o glibc-test
/var/tmp/portage/sys-libs/glibc-2.36-r1/temp/environment: line 3892: ((: #define == 11: syntax error: operand expected (error token is "#define == 11")
 * Running do_src_configure for ABI x86
 *             ABI:   x86
 *          CBUILD:   x86_64-pc-linux-gnu
```

It's because tc-getCPP can't handle at least a large amount of CFLAGS
(seems to handle some okay though). Strip them all out and just use
barebones CC when calling gcc-major-version and friends, then restor
after.

Signed-off-by: Sam James <sam <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/27418
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r3.ebuild | 4 ++++
 sys-libs/glibc/glibc-9999.ebuild    | 7 +++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.36-r3.ebuild b/sys-libs/glibc/glibc-2.36-r3.ebuild
index 012d6984dd74..7d7069dadec8 100644
--- a/sys-libs/glibc/glibc-2.36-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r3.ebuild
@@ -336,10 +336,14 @@ setup_target_flags() {
 				use stack-realign && export CFLAGS_x86+=" -mstackrealign"
 
 				# Workaround for bug #823780.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
 				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
+				CC=${CC_mangled}
 			fi
 		;;
 		mips)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 8456c2a16fe4..68bafd8c3c33 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -26,8 +26,7 @@ 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=""
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi
@@ -337,10 +336,14 @@ setup_target_flags() {
 				use stack-realign && export CFLAGS_x86+=" -mstackrealign"
 
 				# Workaround for bug #823780.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
 				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
+				CC=${CC_mangled}
 			fi
 		;;
 		mips)


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-10-01 20:56 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-10-01 20:56 UTC (permalink / raw
  To: gentoo-commits

commit:     ee6f44ee63f027efdafcdc072f6db1554117d5f3
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  1 20:55:24 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct  1 20:55:53 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee6f44ee

sys-libs/glibc: 2.36 patchset bump

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.36-r4.ebuild | 1628 +++++++++++++++++++++++++++++++++++
 2 files changed, 1629 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 8f526578d263..f69269701803 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,6 +20,7 @@ DIST glibc-2.35-patches-11.tar.xz 222648 BLAKE2B e4c9c9cd033a02183645993af112df2
 DIST glibc-2.35-patches-9.tar.xz 183612 BLAKE2B 921664953ed39560ab850754209dbda1f71fbcc5bcc9ec21c187385ea659b90ea055e60961eca266ab3cc81213ed04747aa925dd96a352676fa19d2e63306968 SHA512 24c9ecb6ad890c95bc0e7db3e0c1f20768c728ac0590450fad05aed578623bc33d256d2c4d14a8d8e5c5e9fed7acfab3683053d236f51886cd5a6de93f925ddc
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-2.36-patches-3.tar.xz 67004 BLAKE2B 185180e113c7aa257b9798577c4f7d80eea169efb02c8a91b203cad1cd65cc51b35e66cf9106978efd0d0c03c834e51e348f27097a04290aed7fec1158c7bc56 SHA512 704cca2d3aaa75694600af6e3aeb20fbebe97f6a03036334382cfd6752dfa0a091d772d350b085907a0722c53aac6fccd9df320ec2d4cd303eba36a3c0e0f39b
+DIST glibc-2.36-patches-4.tar.xz 73612 BLAKE2B 3a0d09bdb11fb910c8192320c84f52765af9c253df2a70e6f2bf86c109946ea447cfc910bf79304a4fc7965da141ac619a8ffaba077605467e2ae5a47570bcf2 SHA512 e0c79865758a0d3970416e545b95cfaa2f209070bdaae0f7c773209641c8181ac4330cc427c5d0130a3ce2052eaa5fff2b7ade8ff8b728bc3f25d1c94751f3a9
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.36-r4.ebuild b/sys-libs/glibc/glibc-2.36-r4.ebuild
new file mode 100644
index 000000000000..bc064d1ad29a
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.36-r4.ebuild
@@ -0,0 +1,1628 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# 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 preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=4
+PATCH_DEV=dilfridge
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 hash-sysv-compat 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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-10-02  8:40 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-10-02  8:40 UTC (permalink / raw
  To: gentoo-commits

commit:     a3d93f81ed9442703de09b684f309d8e1d596571
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  2 08:17:21 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct  2 08:39:52 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a3d93f81

sys-libs/glibc: re-keyword 2.36-r4

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r4.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r4.ebuild b/sys-libs/glibc/glibc-2.36-r4.ebuild
index bc064d1ad29a..59a8996bb72f 100644
--- a/sys-libs/glibc/glibc-2.36-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r4.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-10-15 19:42 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-10-15 19:42 UTC (permalink / raw
  To: gentoo-commits

commit:     d5f6f0a7f7090cc5993191542c93faf1097bc43f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 15 18:56:34 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 15 19:41:57 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d5f6f0a7

sys-libs/glibc: 2.35 patchlevel bump

tests pass

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    1 +
 sys-libs/glibc/glibc-2.35-r11.ebuild | 1623 ++++++++++++++++++++++++++++++++++
 2 files changed, 1624 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index f69269701803..8cdd3417a3fc 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,6 +17,7 @@ DIST glibc-2.34-patches-17.tar.xz 241584 BLAKE2B e4eea130c331f64ba66e14a6ba31885
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-2.35-loongarch-patches-20220522.tar.xz 44728 BLAKE2B 09e7a061f3269ebd763cd700f7c23e6cd7aab738d87ee31f76a81281920c4e5e207964c79104cd75f0a2e07b77344c2a730a9063344aa1483cd3d9aeac87de40 SHA512 21f13892fb52ec753856d5559b032c2be3a76d1cf940127222f7aa878548ce7e6ea0d2ff8791ddb91aaa2b77ce17131cd2fb2ebbdaa99443bf0a6b4c81f7388d
 DIST glibc-2.35-patches-11.tar.xz 222648 BLAKE2B e4c9c9cd033a02183645993af112df20207de8fc51e8f889a567cea1e688dff5d95916a59c6184c0c8c8ca4958b33ba1748cb75185deeae3e15be5eeb49255c7 SHA512 db14b78a50a4fe537a082c8f596a30516b2d5e26958baee65e165e627efdd0e0d6df9393fbfd04062a3fa6f66ef3f9aac4981ffb4f644ef561417c743bbc8a3e
+DIST glibc-2.35-patches-12.tar.xz 266056 BLAKE2B 7979dcfee270107d51c10e5ec74c9c1ab0d0a9743d6718a6d915d241fee6482958c957ef9fd25cd704925e3aa0d98c23115274c7594d149dec08c5e0766a488d SHA512 37a4c086b6a459cb378608a49d90705dddb806376edb2456b8c98e3a469fc558bce7b1b4c8a856b8dffb209e7b6e1c48382ed6f050284c5f74a92ca4f7d4b88a
 DIST glibc-2.35-patches-9.tar.xz 183612 BLAKE2B 921664953ed39560ab850754209dbda1f71fbcc5bcc9ec21c187385ea659b90ea055e60961eca266ab3cc81213ed04747aa925dd96a352676fa19d2e63306968 SHA512 24c9ecb6ad890c95bc0e7db3e0c1f20768c728ac0590450fad05aed578623bc33d256d2c4d14a8d8e5c5e9fed7acfab3683053d236f51886cd5a6de93f925ddc
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-2.36-patches-3.tar.xz 67004 BLAKE2B 185180e113c7aa257b9798577c4f7d80eea169efb02c8a91b203cad1cd65cc51b35e66cf9106978efd0d0c03c834e51e348f27097a04290aed7fec1158c7bc56 SHA512 704cca2d3aaa75694600af6e3aeb20fbebe97f6a03036334382cfd6752dfa0a091d772d350b085907a0722c53aac6fccd9df320ec2d4cd303eba36a3c0e0f39b

diff --git a/sys-libs/glibc/glibc-2.35-r11.ebuild b/sys-libs/glibc/glibc-2.35-r11.ebuild
new file mode 100644
index 000000000000..406e24688ed1
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.35-r11.ebuild
@@ -0,0 +1,1623 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# 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 preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=12
+PATCH_DEV=dilfridge
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	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.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 +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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	filter-flags '-fstack-protector*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+			if ! eend_KV ${build_kv} ${want_kv} ; then
+				echo
+				eerror "You need linux-headers of at least ${want_kv}!"
+				die "linux-headers version too low!"
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		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
+
+	eapply "${FILESDIR}"/2.35/glibc-2.35-make-4.4-MAKEFLAGS.patch
+
+	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
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-10-15 19:42 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-10-15 19:42 UTC (permalink / raw
  To: gentoo-commits

commit:     961b6054cf5fa9071829cee16b5db21c48bdde93
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 15 19:41:15 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 15 19:42:00 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=961b6054

sys-libs/glibc: 2.36 patchlevel bump

tests pass

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.36-r5.ebuild | 1628 +++++++++++++++++++++++++++++++++++
 2 files changed, 1629 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 8cdd3417a3fc..21bcc76e0a83 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -22,6 +22,7 @@ DIST glibc-2.35-patches-9.tar.xz 183612 BLAKE2B 921664953ed39560ab850754209dbda1
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-2.36-patches-3.tar.xz 67004 BLAKE2B 185180e113c7aa257b9798577c4f7d80eea169efb02c8a91b203cad1cd65cc51b35e66cf9106978efd0d0c03c834e51e348f27097a04290aed7fec1158c7bc56 SHA512 704cca2d3aaa75694600af6e3aeb20fbebe97f6a03036334382cfd6752dfa0a091d772d350b085907a0722c53aac6fccd9df320ec2d4cd303eba36a3c0e0f39b
 DIST glibc-2.36-patches-4.tar.xz 73612 BLAKE2B 3a0d09bdb11fb910c8192320c84f52765af9c253df2a70e6f2bf86c109946ea447cfc910bf79304a4fc7965da141ac619a8ffaba077605467e2ae5a47570bcf2 SHA512 e0c79865758a0d3970416e545b95cfaa2f209070bdaae0f7c773209641c8181ac4330cc427c5d0130a3ce2052eaa5fff2b7ade8ff8b728bc3f25d1c94751f3a9
+DIST glibc-2.36-patches-5.tar.xz 81348 BLAKE2B 003a59a992302c21132474bcdc994d10b5d50a94368e949ce28cbe389cefd104f66c48cb61a63d24e2f6db94d010e4220bda3fb5291d088cda88069b928c92e0 SHA512 6d6a16114df2223bf04729a79d12a52e41c9b8e756863c1acbb909dc34696958073604ced1b691579271218738511191ddf517e03a700d3948752c455201bcc4
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.36-r5.ebuild b/sys-libs/glibc/glibc-2.36-r5.ebuild
new file mode 100644
index 000000000000..2679c1370391
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.36-r5.ebuild
@@ -0,0 +1,1628 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# 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 preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=5
+PATCH_DEV=dilfridge
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 hash-sysv-compat 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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-10-15 23:23 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-10-15 23:23 UTC (permalink / raw
  To: gentoo-commits

commit:     34359af11988fd779999cb7168ea386bffd85be3
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 15 23:23:26 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 15 23:23:49 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=34359af1

sys-libs/glibc: keyword 2.35-r11

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r11.ebuild b/sys-libs/glibc/glibc-2.35-r11.ebuild
index 406e24688ed1..9374d5cf5d9b 100644
--- a/sys-libs/glibc/glibc-2.35-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r11.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-10-16  8:50 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-10-16  8:50 UTC (permalink / raw
  To: gentoo-commits

commit:     4d0e1582572fe6346480526b682a97e804434f23
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 16 08:49:37 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct 16 08:49:56 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4d0e1582

sys-libs/glibc: keyword 2.36-r5

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r5.ebuild b/sys-libs/glibc/glibc-2.36-r5.ebuild
index 2679c1370391..d29bb087218f 100644
--- a/sys-libs/glibc/glibc-2.36-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r5.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-06 19:38 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-11-06 19:38 UTC (permalink / raw
  To: gentoo-commits

commit:     7ede9ea53a84074a5f84d2ea1b7e76a3db76535d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  6 19:37:21 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Nov  6 19:37:55 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7ede9ea5

sys-libs/glibc: drop 2.36-r3, 2.36-r4

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 -
 sys-libs/glibc/glibc-2.36-r3.ebuild | 1628 -----------------------------------
 sys-libs/glibc/glibc-2.36-r4.ebuild | 1628 -----------------------------------
 3 files changed, 3258 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 21bcc76e0a83..0e4d43fa4da6 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,8 +20,6 @@ DIST glibc-2.35-patches-11.tar.xz 222648 BLAKE2B e4c9c9cd033a02183645993af112df2
 DIST glibc-2.35-patches-12.tar.xz 266056 BLAKE2B 7979dcfee270107d51c10e5ec74c9c1ab0d0a9743d6718a6d915d241fee6482958c957ef9fd25cd704925e3aa0d98c23115274c7594d149dec08c5e0766a488d SHA512 37a4c086b6a459cb378608a49d90705dddb806376edb2456b8c98e3a469fc558bce7b1b4c8a856b8dffb209e7b6e1c48382ed6f050284c5f74a92ca4f7d4b88a
 DIST glibc-2.35-patches-9.tar.xz 183612 BLAKE2B 921664953ed39560ab850754209dbda1f71fbcc5bcc9ec21c187385ea659b90ea055e60961eca266ab3cc81213ed04747aa925dd96a352676fa19d2e63306968 SHA512 24c9ecb6ad890c95bc0e7db3e0c1f20768c728ac0590450fad05aed578623bc33d256d2c4d14a8d8e5c5e9fed7acfab3683053d236f51886cd5a6de93f925ddc
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
-DIST glibc-2.36-patches-3.tar.xz 67004 BLAKE2B 185180e113c7aa257b9798577c4f7d80eea169efb02c8a91b203cad1cd65cc51b35e66cf9106978efd0d0c03c834e51e348f27097a04290aed7fec1158c7bc56 SHA512 704cca2d3aaa75694600af6e3aeb20fbebe97f6a03036334382cfd6752dfa0a091d772d350b085907a0722c53aac6fccd9df320ec2d4cd303eba36a3c0e0f39b
-DIST glibc-2.36-patches-4.tar.xz 73612 BLAKE2B 3a0d09bdb11fb910c8192320c84f52765af9c253df2a70e6f2bf86c109946ea447cfc910bf79304a4fc7965da141ac619a8ffaba077605467e2ae5a47570bcf2 SHA512 e0c79865758a0d3970416e545b95cfaa2f209070bdaae0f7c773209641c8181ac4330cc427c5d0130a3ce2052eaa5fff2b7ade8ff8b728bc3f25d1c94751f3a9
 DIST glibc-2.36-patches-5.tar.xz 81348 BLAKE2B 003a59a992302c21132474bcdc994d10b5d50a94368e949ce28cbe389cefd104f66c48cb61a63d24e2f6db94d010e4220bda3fb5291d088cda88069b928c92e0 SHA512 6d6a16114df2223bf04729a79d12a52e41c9b8e756863c1acbb909dc34696958073604ced1b691579271218738511191ddf517e03a700d3948752c455201bcc4
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238

diff --git a/sys-libs/glibc/glibc-2.36-r3.ebuild b/sys-libs/glibc/glibc-2.36-r3.ebuild
deleted file mode 100644
index 7d7069dadec8..000000000000
--- a/sys-libs/glibc/glibc-2.36-r3.ebuild
+++ /dev/null
@@ -1,1628 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# 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 preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=3
-PATCH_DEV=dilfridge
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 hash-sysv-compat 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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.36-r4.ebuild b/sys-libs/glibc/glibc-2.36-r4.ebuild
deleted file mode 100644
index 59a8996bb72f..000000000000
--- a/sys-libs/glibc/glibc-2.36-r4.ebuild
+++ /dev/null
@@ -1,1628 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# 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 preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=4
-PATCH_DEV=dilfridge
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 hash-sysv-compat 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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		virtual/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	virtual/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-15 14:51 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-11-15 14:51 UTC (permalink / raw
  To: gentoo-commits

commit:     fefe4d88dbdba04d4830c8af2837e9dbd22db542
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 15 14:50:59 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Tue Nov 15 14:50:59 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fefe4d88

sys-libs/glibc: Stabilize 2.35-r11 hppa, #879213

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r11.ebuild b/sys-libs/glibc/glibc-2.35-r11.ebuild
index 9374d5cf5d9b..30f64b22a1ec 100644
--- a/sys-libs/glibc/glibc-2.35-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r11.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-15 14:51 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-11-15 14:51 UTC (permalink / raw
  To: gentoo-commits

commit:     dc8b968855c23e4c2b3f35b0b54ff52d404064c4
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 15 14:50:59 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Tue Nov 15 14:50:59 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dc8b9688

sys-libs/glibc: Stabilize 2.36-r5 hppa, #879213

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r5.ebuild b/sys-libs/glibc/glibc-2.36-r5.ebuild
index d29bb087218f..4b15f9e9f9c2 100644
--- a/sys-libs/glibc/glibc-2.36-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r5.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-15 20:09 Michał Górny
  0 siblings, 0 replies; 1076+ messages in thread
From: Michał Górny @ 2022-11-15 20:09 UTC (permalink / raw
  To: gentoo-commits

commit:     1818093f658a8962a6e1b6a62b60de003c8ac94b
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 15 20:08:54 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Nov 15 20:09:28 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1818093f

sys-libs/glibc: Remove old version requiring py38

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    3 -
 sys-libs/glibc/glibc-2.30-r9.ebuild | 1471 -----------------------------------
 2 files changed, 1474 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 0e4d43fa4da6..6170c83e1b31 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -4,9 +4,6 @@ DIST gcc-multilib-bootstrap-20180511.tar.xz 2392908 BLAKE2B f3cf614399368acd8908
 DIST gcc-multilib-bootstrap-20201208.tar.xz 5528452 BLAKE2B 16699a6e4df5b2f28a21776ae9e3728b26a9ea251f5580aa5349545ad7c9f6145b9cb6a12ca8f5f96b9cb2a3c70b7e66ca702e4c6f083ac00408e0a20a69e613 SHA512 a243f505e17d0a7e144e8713c077582412f61d6cf7f79baa846de4fb77f5e0f27e11c9a785e14624e04ac52287b32164e7995323aa11caef59113ac438254347
 DIST glibc-2.19-patches-9.tar.bz2 24584 BLAKE2B a96e930a5bd20fa75d9f259cc2117fa5ce98072274a24a5823bf877e3739fa4c001a94d7865e065ee0527f3974430d27da8038e042340a451ad2052c62724f26 SHA512 a95b3063ade974a3556480b798b317d33c7423a8cb9e69f67249ffb8b3d3c671d70d2d5f782c1efadc0bec4cc49a96d4fe89911f3dfcd85b459f69f3b4f38f0e
 DIST glibc-2.19.tar.xz 12083312 BLAKE2B 9dc03346e0f0df4bf009a92d894b0a9f964ff92b7f4c9663cedf1cb6cf90435f28a15539d33791ecf43ee578fa4e26f916af0367651312ef8f9c1c38ce0dafa2 SHA512 9e021fcb3afbb9ace2a0e37fded231a62de861bd766e29d47163a03182e37add718b7acc3963d1c525f9556773e842297725715acde48dcfbaab6e756af1a23d
-DIST glibc-2.30-patches-10.tar.xz 72808 BLAKE2B a7a95c99482524b2896d15539766f1e6b1fe34a22f32119248c6dd44f42632076e86fdcbbdc2d604ec73ceccdd8a7f5936a62a6f4c3d039fae8f6901dfc6be77 SHA512 af5e213ff08bf38f6f529816c36b4e38df27207c2df254609ebe45b2f039ab553bbe563aa6f64b6667d328fd2c120dc21b6e2676540bdd94e58079237089eac3
-DIST glibc-2.30-sparc-reg-fix-clobber.patch 6106 BLAKE2B cad6a4cbef5d529519ef486f4ef8e189cb4d43dd67fa8f8d50d67072cbb682f60474d482a5c5152d1317de92b98851d8a88eee6b331eb5bc22de065c03c58fde SHA512 a018ef1f196257f3888af20a5cbc97892c8382a4f489da042568e087c077f30cf4dda6ac711b573e1274317866ce97cf817d92a28cf55f18f5e8d32787e6cb3f
-DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
 DIST glibc-2.31-patches-9.tar.xz 74712 BLAKE2B 62991b67de4def4cca944e8420d2f0139f88b6754c6bc81072bb321c574c1db22641857345325848e1dfb551c10758f582e4425e687a7921cdbd4e7e7923a047 SHA512 699d898e3a8ed02b04573c675f572076e8f747767bfc577a033a49cd7d9078a7a60ac325acd4bd419a93b56edf90ce067baa7578ab315e27885f1f0e13916354
 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
 DIST glibc-2.32-patches-8.tar.xz 65532 BLAKE2B 00c572cff396e52313d0324f7bc28192a65f06b22fc5a04aa631b76b3016842365006399715531ee693f3519720edcebef7884247f2f8c19e3518c1ddafab7cc SHA512 5240bc3a6df46d12c03ea4ce7b1a0df85301256ae3bd003fd04c61dadaaec34998873bf20544d891f6eedf896302bb916010aebc1d8d646a3cce09a93b533d0b

diff --git a/sys-libs/glibc/glibc-2.30-r9.ebuild b/sys-libs/glibc/glibc-2.30-r9.ebuild
deleted file mode 100644
index 7e8c90410820..000000000000
--- a/sys-libs/glibc/glibc-2.30-r9.ebuild
+++ /dev/null
@@ -1,1471 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-if [[ ${PV} == 9999* ]]; then
-	EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20180511
-
-# Gentoo patchset
-PATCH_VER=10
-PATCH_DEV=dilfridge
-
-SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
-SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/glibc-2.30-sparc-reg-fix-clobber.patch"
-
-IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test vanilla"
-
-# Minimum kernel version that glibc requires
-MIN_KERN_VER="3.2.0"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-0.1.10
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.24
-		>=${CATEGORY}/gcc-6
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.24
-		>=sys-devel/gcc-6
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 1) Sandbox
-	tst-ldconfig-bad-aux-cache
-	tst-pldd
-	tst-mallocfork2
-	tst-nss-db-endgrent
-	tst-nss-db-endpwent
-	tst-nss-files-hosts-long
-	tst-nss-test3
-	# 2) Namespaces and cgroup
-	tst-locale-locpath
-	# 9) Failures of unknown origin
-	tst-latepthread
-
-	# buggy test, fixed in glibc-2.31 in 70ba28f7ab29
-	tst-pkey
-
-	# 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
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				export CFLAGS="-march=${t} ${CFLAGS}"
-				einfo "Auto adding -march=${t} to CFLAGS #185404"
-			fi
-		;;
-		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})"
-			fi
-		;;
-		ia64)
-			# Workaround GPREL22 overflow by slightly pessimizing global
-			# references to go via 64-bit relocations instead of 22-bit ones.
-			# This allows building glibc on ia64 without an overflow: #723268
-			append-flags -fcommon
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	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}
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-	local VAR=CFLAGS_${ABI}
-	# 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}"
-}
-
-foreach_abi() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# Check for sanity of /etc/nsswitch.conf
-	if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
-		local entry
-		for entry in passwd group shadow; do
-			if ! grep -E -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
-				eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
-				eerror "Please make sure you have 'files' entries for"
-				eerror "'passwd:', 'group:' and 'shadow:' databases."
-				eerror "For more details see:"
-				eerror "  https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
-				die "nsswitch.conf has no 'files' provider in '${entry}'."
-			fi
-		done
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	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!"
-		fi
-
-		if [[ ${CTARGET} == *-linux* ]] ; then
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	fi
-}
-
-#
-# the phases
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	# All the checks...
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	# Consistency is not guaranteed between pkg_ and src_ ...
-	sanity_prechecks
-
-	use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	setup_env
-
-	if [[ -n ${EGIT_REPO_URI} ]] ; then
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
-}
-
-src_prepare() {
-	if ! use vanilla ; then
-		elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
-		eapply "${WORKDIR}"/patches
-		eapply "${DISTDIR}"/glibc-2.30-sparc-reg-fix-clobber.patch
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-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 ; 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}"
-
-	echo
-
-	local myconf=()
-
-	case ${CTARGET} in
-		m68k*)
-			# setjmp() is not compatible with stack protection:
-			# https://sourceware.org/PR24202
-			myconf+=( --enable-stack-protector=no )
-			;;
-		powerpc-*)
-			# Currently gcc on powerpc32 generates invalid code for
-			# __builtin_return_address(0) calls. Normally programs
-			# don't do that but malloc hooks in glibc do:
-			# https://gcc.gnu.org/PR81996
-			# https://bugs.gentoo.org/629054
-			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 )
-
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--without-cvs
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	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}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	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"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	emake ${myxfailparams} check
-}
-
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	# Make sure all the ABI's can find the locales and so we only
-	# have to generate one set
-	local a
-	keepdir /usr/$(get_libdir)/locale
-	for a in $(get_install_abis) ; do
-		if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
-			dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
-		fi
-	done
-
-	# HACK: If we're building for riscv, we need to additionally make sure that
-	# we can find the locale archive afterwards
-	case ${CTARGET} in
-		riscv*)
-			if [[ ! -e ${ED}/usr/lib/locale ]] ; then
-				dosym ../$(get_libdir)/locale /usr/lib/locale
-			fi
-			;;
-		*) ;;
-	esac
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
-	doins "${WORKDIR}"/extra/etc/*.conf
-
-	if use nscd ; then
-		doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	else
-		# Do this since extra/etc/*.conf above might have nscd.conf.
-		rm -f "${ED}"/etc/nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		elog "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (e.g. /var/tmp/portage:${HOSTNAME})
-	pushd "${ED}"/$(get_libdir) >/dev/null
-
-	local x striptest
-	for x in cal date env free ls true uname uptime ; do
-		x=$(type -p ${x})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}/"
-	fi
-
-	# 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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			fi
-		done
-	fi
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-16 19:22 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-11-16 19:22 UTC (permalink / raw
  To: gentoo-commits

commit:     5a45e465c1894845643fc47605f343779482aa33
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 16 19:22:18 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov 16 19:22:18 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a45e465

sys-libs/glibc: Stabilize 2.35-r11 amd64, #879213

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r11.ebuild b/sys-libs/glibc/glibc-2.35-r11.ebuild
index 30f64b22a1ec..5366116c47a7 100644
--- a/sys-libs/glibc/glibc-2.35-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r11.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-16 19:22 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2022-11-16 19:22 UTC (permalink / raw
  To: gentoo-commits

commit:     7fd0d767d1312544ec2390a5f8b0355c208a5ca5
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 16 19:22:19 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov 16 19:22:19 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7fd0d767

sys-libs/glibc: Stabilize 2.36-r5 amd64, #879213

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r5.ebuild b/sys-libs/glibc/glibc-2.36-r5.ebuild
index 4b15f9e9f9c2..507e1730b4f9 100644
--- a/sys-libs/glibc/glibc-2.36-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r5.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-18 15:42 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-11-18 15:42 UTC (permalink / raw
  To: gentoo-commits

commit:     d3c7836953bcc83658db7c416eff27b4cb6a3d0f
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 18 15:42:03 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Nov 18 15:42:03 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d3c78369

sys-libs/glibc: Stabilize 2.35-r11 arm64, #879213

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r11.ebuild b/sys-libs/glibc/glibc-2.35-r11.ebuild
index f33de3a84567..38db0d252732 100644
--- a/sys-libs/glibc/glibc-2.35-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r11.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-18 15:42 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-11-18 15:42 UTC (permalink / raw
  To: gentoo-commits

commit:     5f5cded4e311002974621f2ff9ee209dd5efb7b4
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 18 15:42:00 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Nov 18 15:42:00 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5f5cded4

sys-libs/glibc: Stabilize 2.36-r5 arm, #879213

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r5.ebuild b/sys-libs/glibc/glibc-2.36-r5.ebuild
index 507e1730b4f9..e09bd26d367b 100644
--- a/sys-libs/glibc/glibc-2.36-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r5.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-18 15:42 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-11-18 15:42 UTC (permalink / raw
  To: gentoo-commits

commit:     a112cf2ad97f7c079d26304cebac910aaec5bd0d
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 18 15:41:59 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Nov 18 15:41:59 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a112cf2a

sys-libs/glibc: Stabilize 2.35-r11 arm, #879213

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r11.ebuild b/sys-libs/glibc/glibc-2.35-r11.ebuild
index 5366116c47a7..f33de3a84567 100644
--- a/sys-libs/glibc/glibc-2.35-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r11.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-18 15:42 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-11-18 15:42 UTC (permalink / raw
  To: gentoo-commits

commit:     45bcb601e4021b000b58d48c910966c84372d66d
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 18 15:42:04 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Nov 18 15:42:04 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=45bcb601

sys-libs/glibc: Stabilize 2.36-r5 arm64, #879213

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r5.ebuild b/sys-libs/glibc/glibc-2.36-r5.ebuild
index e09bd26d367b..911ce694a5b4 100644
--- a/sys-libs/glibc/glibc-2.36-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r5.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-18 18:01 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-11-18 18:01 UTC (permalink / raw
  To: gentoo-commits

commit:     ff5474cb027b2d622d77b7e518699780b8f79304
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 18 18:01:11 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Nov 18 18:01:11 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ff5474cb

sys-libs/glibc: Stabilize 2.35-r11 sparc, #879213

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r11.ebuild b/sys-libs/glibc/glibc-2.35-r11.ebuild
index 38db0d252732..639b83ba1977 100644
--- a/sys-libs/glibc/glibc-2.35-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r11.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc ~x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-18 18:01 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-11-18 18:01 UTC (permalink / raw
  To: gentoo-commits

commit:     a966b1b93b5ef81ac64649ce917268dd985ca325
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 18 18:01:12 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Nov 18 18:01:12 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a966b1b9

sys-libs/glibc: Stabilize 2.36-r5 sparc, #879213

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r5.ebuild b/sys-libs/glibc/glibc-2.36-r5.ebuild
index 911ce694a5b4..7b69394a3d11 100644
--- a/sys-libs/glibc/glibc-2.36-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r5.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-19 16:09 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-11-19 16:09 UTC (permalink / raw
  To: gentoo-commits

commit:     0c10624dc5be9fddf7e939b9f9ffdd0fbc4da832
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 19 16:09:41 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 19 16:09:41 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0c10624d

sys-libs/glibc: Stabilize 2.35-r11 ppc64, #879213

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r11.ebuild b/sys-libs/glibc/glibc-2.35-r11.ebuild
index 639b83ba1977..7ba1c0f10cf3 100644
--- a/sys-libs/glibc/glibc-2.35-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r11.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc ~x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-19 16:09 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-11-19 16:09 UTC (permalink / raw
  To: gentoo-commits

commit:     30b151128e250f771997710de6ff82dd3d810abf
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 19 16:09:45 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 19 16:09:45 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=30b15112

sys-libs/glibc: Stabilize 2.35-r11 ppc, #879213

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r11.ebuild b/sys-libs/glibc/glibc-2.35-r11.ebuild
index 7ba1c0f10cf3..706610c41650 100644
--- a/sys-libs/glibc/glibc-2.35-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r11.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-19 16:09 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-11-19 16:09 UTC (permalink / raw
  To: gentoo-commits

commit:     7f5ebd9646cd365568f9453a53f5ca6463d4afd7
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 19 16:09:41 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 19 16:09:41 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7f5ebd96

sys-libs/glibc: Stabilize 2.36-r5 ppc64, #879213

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r5.ebuild b/sys-libs/glibc/glibc-2.36-r5.ebuild
index 7b69394a3d11..54ca86e6b0ea 100644
--- a/sys-libs/glibc/glibc-2.36-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r5.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-19 16:09 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-11-19 16:09 UTC (permalink / raw
  To: gentoo-commits

commit:     6d36615dd23f5c210ef9f001d75a703c9df13dc7
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 19 16:09:45 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 19 16:09:45 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d36615d

sys-libs/glibc: Stabilize 2.36-r5 ppc, #879213

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r5.ebuild b/sys-libs/glibc/glibc-2.36-r5.ebuild
index 54ca86e6b0ea..43585018c0f8 100644
--- a/sys-libs/glibc/glibc-2.36-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r5.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-19 19:03 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-11-19 19:03 UTC (permalink / raw
  To: gentoo-commits

commit:     b4a585302e7c9ac5452666d4bf648217f0420180
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 19 19:02:52 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Nov 19 19:03:28 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b4a58530

sys-libs/glibc: 2.36 patchset bump, including gcc-13 fixes

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.36-r6.ebuild | 1628 +++++++++++++++++++++++++++++++++++
 2 files changed, 1629 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 6170c83e1b31..a63edd22d108 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,6 +18,7 @@ DIST glibc-2.35-patches-12.tar.xz 266056 BLAKE2B 7979dcfee270107d51c10e5ec74c9c1
 DIST glibc-2.35-patches-9.tar.xz 183612 BLAKE2B 921664953ed39560ab850754209dbda1f71fbcc5bcc9ec21c187385ea659b90ea055e60961eca266ab3cc81213ed04747aa925dd96a352676fa19d2e63306968 SHA512 24c9ecb6ad890c95bc0e7db3e0c1f20768c728ac0590450fad05aed578623bc33d256d2c4d14a8d8e5c5e9fed7acfab3683053d236f51886cd5a6de93f925ddc
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-2.36-patches-5.tar.xz 81348 BLAKE2B 003a59a992302c21132474bcdc994d10b5d50a94368e949ce28cbe389cefd104f66c48cb61a63d24e2f6db94d010e4220bda3fb5291d088cda88069b928c92e0 SHA512 6d6a16114df2223bf04729a79d12a52e41c9b8e756863c1acbb909dc34696958073604ced1b691579271218738511191ddf517e03a700d3948752c455201bcc4
+DIST glibc-2.36-patches-6.tar.xz 100540 BLAKE2B bdd887bd61c5c3f8047e31b1380344da82a5e9c7fe6cf0ebd1177a1dd40462872dd9507594b6669140a1a8c6c08ce3195a3f8d425ce5e2a2ff6e9b42d90c43ed SHA512 3a2620e87eba62d3276c5b09b97337bffe3a51bf23da243fb550f6f9dddb77008a7840ede32b7b1a7ff72e06b89981d9edf27026931a12fae8042002d8328358
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.36-r6.ebuild b/sys-libs/glibc/glibc-2.36-r6.ebuild
new file mode 100644
index 000000000000..2ffd8d33abdc
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.36-r6.ebuild
@@ -0,0 +1,1628 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# 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 preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=6
+PATCH_DEV=dilfridge
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 hash-sysv-compat 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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		virtual/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	virtual/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-11-27 16:23 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-11-27 16:23 UTC (permalink / raw
  To: gentoo-commits

commit:     7736f59f64944be40d4a07dded63307b516112f8
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 27 16:20:43 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Nov 27 16:23:08 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7736f59f

sys-libs/glibc: keyword 2.36-r6

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r6.ebuild b/sys-libs/glibc/glibc-2.36-r6.ebuild
index 2ffd8d33abdc..5e0284176696 100644
--- a/sys-libs/glibc/glibc-2.36-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r6.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-12-02 19:39 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-12-02 19:39 UTC (permalink / raw
  To: gentoo-commits

commit:     37d17284dc7c10ddd6cdc1cf418b5fd8348d1f63
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec  2 19:39:46 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Dec  2 19:39:46 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=37d17284

sys-libs/glibc: Stabilize 2.35-r11 x86, #879213

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.35-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.35-r11.ebuild b/sys-libs/glibc/glibc-2.35-r11.ebuild
index f76bf59f7d8f..f5db1800e2b5 100644
--- a/sys-libs/glibc/glibc-2.35-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r11.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	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 )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-12-02 19:39 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2022-12-02 19:39 UTC (permalink / raw
  To: gentoo-commits

commit:     6aae08de003b71b4cff8398a1c08c0bc92b7c50b
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec  2 19:39:47 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Dec  2 19:39:47 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6aae08de

sys-libs/glibc: Stabilize 2.36-r5 x86, #879213

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r5.ebuild b/sys-libs/glibc/glibc-2.36-r5.ebuild
index 2145a40f5a4a..2a08c5b11f27 100644
--- a/sys-libs/glibc/glibc-2.36-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r5.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2022-12-05 23:17 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2022-12-05 23:17 UTC (permalink / raw
  To: gentoo-commits

commit:     aebe34585bd927ece8a8984ff9a27a4032378a6c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Dec  5 23:17:00 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Dec  5 23:17:33 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aebe3458

sys-libs/glibc: drop 2.35-r8, 2.35-r10

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    2 -
 sys-libs/glibc/glibc-2.35-r10.ebuild | 1623 ----------------------------------
 sys-libs/glibc/glibc-2.35-r8.ebuild  | 1612 ---------------------------------
 3 files changed, 3237 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index a63edd22d108..24e66dbac394 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -13,9 +13,7 @@ DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d91116
 DIST glibc-2.34-patches-17.tar.xz 241584 BLAKE2B e4eea130c331f64ba66e14a6ba318853141ee3e41b455cb45b8fdb702cae071dd307229dafcfcafcc41e5a56982f52c87e31d95295f824f1a2ae689a7e0f5b49 SHA512 c6a51b373be3986e1ad753541ccf73f29515b5df0f80e0450b26bed37e8c505e22e8f13e89554347e551819c8d89d30f306464e5d25cafa4a12400c112578dca
 DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
 DIST glibc-2.35-loongarch-patches-20220522.tar.xz 44728 BLAKE2B 09e7a061f3269ebd763cd700f7c23e6cd7aab738d87ee31f76a81281920c4e5e207964c79104cd75f0a2e07b77344c2a730a9063344aa1483cd3d9aeac87de40 SHA512 21f13892fb52ec753856d5559b032c2be3a76d1cf940127222f7aa878548ce7e6ea0d2ff8791ddb91aaa2b77ce17131cd2fb2ebbdaa99443bf0a6b4c81f7388d
-DIST glibc-2.35-patches-11.tar.xz 222648 BLAKE2B e4c9c9cd033a02183645993af112df20207de8fc51e8f889a567cea1e688dff5d95916a59c6184c0c8c8ca4958b33ba1748cb75185deeae3e15be5eeb49255c7 SHA512 db14b78a50a4fe537a082c8f596a30516b2d5e26958baee65e165e627efdd0e0d6df9393fbfd04062a3fa6f66ef3f9aac4981ffb4f644ef561417c743bbc8a3e
 DIST glibc-2.35-patches-12.tar.xz 266056 BLAKE2B 7979dcfee270107d51c10e5ec74c9c1ab0d0a9743d6718a6d915d241fee6482958c957ef9fd25cd704925e3aa0d98c23115274c7594d149dec08c5e0766a488d SHA512 37a4c086b6a459cb378608a49d90705dddb806376edb2456b8c98e3a469fc558bce7b1b4c8a856b8dffb209e7b6e1c48382ed6f050284c5f74a92ca4f7d4b88a
-DIST glibc-2.35-patches-9.tar.xz 183612 BLAKE2B 921664953ed39560ab850754209dbda1f71fbcc5bcc9ec21c187385ea659b90ea055e60961eca266ab3cc81213ed04747aa925dd96a352676fa19d2e63306968 SHA512 24c9ecb6ad890c95bc0e7db3e0c1f20768c728ac0590450fad05aed578623bc33d256d2c4d14a8d8e5c5e9fed7acfab3683053d236f51886cd5a6de93f925ddc
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-2.36-patches-5.tar.xz 81348 BLAKE2B 003a59a992302c21132474bcdc994d10b5d50a94368e949ce28cbe389cefd104f66c48cb61a63d24e2f6db94d010e4220bda3fb5291d088cda88069b928c92e0 SHA512 6d6a16114df2223bf04729a79d12a52e41c9b8e756863c1acbb909dc34696958073604ced1b691579271218738511191ddf517e03a700d3948752c455201bcc4
 DIST glibc-2.36-patches-6.tar.xz 100540 BLAKE2B bdd887bd61c5c3f8047e31b1380344da82a5e9c7fe6cf0ebd1177a1dd40462872dd9507594b6669140a1a8c6c08ce3195a3f8d425ce5e2a2ff6e9b42d90c43ed SHA512 3a2620e87eba62d3276c5b09b97337bffe3a51bf23da243fb550f6f9dddb77008a7840ede32b7b1a7ff72e06b89981d9edf27026931a12fae8042002d8328358

diff --git a/sys-libs/glibc/glibc-2.35-r10.ebuild b/sys-libs/glibc/glibc-2.35-r10.ebuild
deleted file mode 100644
index f56ed3b86043..000000000000
--- a/sys-libs/glibc/glibc-2.35-r10.ebuild
+++ /dev/null
@@ -1,1623 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# 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 preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=11
-PATCH_DEV=dilfridge
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	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.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 +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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		app-alternatives/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		app-alternatives/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	app-alternatives/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	filter-flags '-fstack-protector*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		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
-
-	eapply "${FILESDIR}"/2.35/glibc-2.35-make-4.4-MAKEFLAGS.patch
-
-	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
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.35-r8.ebuild b/sys-libs/glibc/glibc-2.35-r8.ebuild
deleted file mode 100644
index 475fa00a70f2..000000000000
--- a/sys-libs/glibc/glibc-2.35-r8.ebuild
+++ /dev/null
@@ -1,1612 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# 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 preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=9
-PATCH_DEV=dilfridge
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
-	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.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 +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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		app-alternatives/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		app-alternatives/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	app-alternatives/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	filter-flags '-fstack-protector*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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 CPP="${current_gcc_path}/cpp"
-		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. (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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-			if ! eend_KV ${build_kv} ${want_kv} ; then
-				echo
-				eerror "You need linux-headers of at least ${want_kv}!"
-				die "linux-headers version too low!"
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		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
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-
-	local v
-	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
-
-	echo
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-01-10 22:47 James Le Cuirot
  0 siblings, 0 replies; 1076+ messages in thread
From: James Le Cuirot @ 2023-01-10 22:47 UTC (permalink / raw
  To: gentoo-commits

commit:     fc216dbf67e3a1199e9f2643ffa1707ee056adff
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  7 16:43:57 2023 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Tue Jan 10 22:46:11 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc216dbf

sys-libs/glibc: Fix automagic Perl dependency that breaks Prefix QA checks

/usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if Perl hasn't
been installed inside the prefix yet and configure picks up a Perl from outside
the prefix instead. With this change, configure will fail to execute Perl during
configure if we're cross-compiling a prefix, but it will just disable mtrace in
that case.

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r6.ebuild | 10 +++++++++-
 sys-libs/glibc/glibc-9999.ebuild    | 10 +++++++++-
 sys-libs/glibc/metadata.xml         |  1 +
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.36-r6.ebuild b/sys-libs/glibc/glibc-2.36-r6.ebuild
index 931064fe449e..c0c600c67cef 100644
--- a/sys-libs/glibc/glibc-2.36-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r6.ebuild
@@ -43,7 +43,7 @@ SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${L
 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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -118,6 +118,7 @@ COMMON_DEPEND="
 		audit? ( sys-process/audit )
 		caps? ( sys-libs/libcap )
 	) )
+	perl? ( dev-lang/perl )
 	suid? ( caps? ( sys-libs/libcap ) )
 	selinux? ( sys-libs/libselinux )
 	systemtap? ( dev-util/systemtap )
@@ -1009,6 +1010,13 @@ glibc_do_configure() {
 		$(use_enable systemtap)
 		$(use_enable nscd)
 
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl no)"
+
 		# locale data is arch-independent
 		# https://bugs.gentoo.org/753740
 		libc_cv_complocaledir='${exec_prefix}/lib/locale'

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f35acd536613..e205c7ea5425 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -43,7 +43,7 @@ SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${L
 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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -118,6 +118,7 @@ COMMON_DEPEND="
 		audit? ( sys-process/audit )
 		caps? ( sys-libs/libcap )
 	) )
+	perl? ( dev-lang/perl )
 	suid? ( caps? ( sys-libs/libcap ) )
 	selinux? ( sys-libs/libselinux )
 	systemtap? ( dev-util/systemtap )
@@ -1009,6 +1010,13 @@ glibc_do_configure() {
 		$(use_enable systemtap)
 		$(use_enable nscd)
 
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl no)"
+
 		# locale data is arch-independent
 		# https://bugs.gentoo.org/753740
 		libc_cv_complocaledir='${exec_prefix}/lib/locale'

diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
index 69c29b299aab..846d01d34e0c 100644
--- a/sys-libs/glibc/metadata.xml
+++ b/sys-libs/glibc/metadata.xml
@@ -17,6 +17,7 @@
 		<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="nscd">Build, and enable support for, the Name Service Cache Daemon</flag>
+		<flag name="perl">Install additional scripts written in Perl</flag>
 		<flag name="ssp">protect stack of glibc internals</flag>
 		<flag name="stack-realign">Realign the stack in the 32-bit build for compatibility with older binaries at some performance cost</flag>
 		<flag name="static-pie">Enable static PIE support (runtime files for -static-pie gcc option).</flag>


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-01-20 23:59 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-01-20 23:59 UTC (permalink / raw
  To: gentoo-commits

commit:     9bc453ddfa97fe15588b7b61ee794d0c0d696f44
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 20 23:58:11 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Jan 20 23:58:52 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9bc453dd

sys-libs/glibc: 2.36 patchset 8 bump

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.36-r7.ebuild | 1636 +++++++++++++++++++++++++++++++++++
 2 files changed, 1637 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 24e66dbac394..bbabe8853a05 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,6 +17,7 @@ DIST glibc-2.35-patches-12.tar.xz 266056 BLAKE2B 7979dcfee270107d51c10e5ec74c9c1
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-2.36-patches-5.tar.xz 81348 BLAKE2B 003a59a992302c21132474bcdc994d10b5d50a94368e949ce28cbe389cefd104f66c48cb61a63d24e2f6db94d010e4220bda3fb5291d088cda88069b928c92e0 SHA512 6d6a16114df2223bf04729a79d12a52e41c9b8e756863c1acbb909dc34696958073604ced1b691579271218738511191ddf517e03a700d3948752c455201bcc4
 DIST glibc-2.36-patches-6.tar.xz 100540 BLAKE2B bdd887bd61c5c3f8047e31b1380344da82a5e9c7fe6cf0ebd1177a1dd40462872dd9507594b6669140a1a8c6c08ce3195a3f8d425ce5e2a2ff6e9b42d90c43ed SHA512 3a2620e87eba62d3276c5b09b97337bffe3a51bf23da243fb550f6f9dddb77008a7840ede32b7b1a7ff72e06b89981d9edf27026931a12fae8042002d8328358
+DIST glibc-2.36-patches-8.tar.xz 109968 BLAKE2B b8feaadca2283bd293b1ff13f4714b00dcae0720c3ec8e332275728c1a41fc0d76633423b073d49593d8924690004ec9e56389e7802d3803b1f805e960e5092b SHA512 50eb74ce0b8861c979146a710267e391840c8f5fc7cb90490696865665c816233708c8c07337d16537abf172d6234234f5aac8ea726d846a228924455b219f9e
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
new file mode 100644
index 000000000000..0027c6f4aaa2
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.36-r7.ebuild
@@ -0,0 +1,1636 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..11} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=8
+PATCH_DEV=dilfridge
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl 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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		app-alternatives/awk
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	perl? ( dev-lang/perl )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		app-alternatives/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	app-alternatives/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl no)"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-01-21  0:46 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-01-21  0:46 UTC (permalink / raw
  To: gentoo-commits

commit:     074363b99bf6a8e0e5a9de95dce5a2d97dbfd23a
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 21 00:45:46 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jan 21 00:46:00 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=074363b9

sys-libs/glibc: bump to 2.36 patchset 9

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             | 2 +-
 sys-libs/glibc/glibc-2.36-r7.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index bbabe8853a05..3d0e4a769fb0 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,7 +17,7 @@ DIST glibc-2.35-patches-12.tar.xz 266056 BLAKE2B 7979dcfee270107d51c10e5ec74c9c1
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-2.36-patches-5.tar.xz 81348 BLAKE2B 003a59a992302c21132474bcdc994d10b5d50a94368e949ce28cbe389cefd104f66c48cb61a63d24e2f6db94d010e4220bda3fb5291d088cda88069b928c92e0 SHA512 6d6a16114df2223bf04729a79d12a52e41c9b8e756863c1acbb909dc34696958073604ced1b691579271218738511191ddf517e03a700d3948752c455201bcc4
 DIST glibc-2.36-patches-6.tar.xz 100540 BLAKE2B bdd887bd61c5c3f8047e31b1380344da82a5e9c7fe6cf0ebd1177a1dd40462872dd9507594b6669140a1a8c6c08ce3195a3f8d425ce5e2a2ff6e9b42d90c43ed SHA512 3a2620e87eba62d3276c5b09b97337bffe3a51bf23da243fb550f6f9dddb77008a7840ede32b7b1a7ff72e06b89981d9edf27026931a12fae8042002d8328358
-DIST glibc-2.36-patches-8.tar.xz 109968 BLAKE2B b8feaadca2283bd293b1ff13f4714b00dcae0720c3ec8e332275728c1a41fc0d76633423b073d49593d8924690004ec9e56389e7802d3803b1f805e960e5092b SHA512 50eb74ce0b8861c979146a710267e391840c8f5fc7cb90490696865665c816233708c8c07337d16537abf172d6234234f5aac8ea726d846a228924455b219f9e
+DIST glibc-2.36-patches-9.tar.xz 110440 BLAKE2B edc1aca9b7bc9ce64683e3bd905c9804b581af2d41191ae85e6f0e73d444672abe56bbb620373d31b20db8f84a2cb9ed4e1026e50ce5f287dac5c24752ee187a SHA512 1f1f85a439983b776229b924f9a8fd9aacf9efc869a212ff15b49e60627f37719b548d20b9ff1b80d88996bce115f44efdbecc6dce378a4247c6078ed7e6e1b4
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
index 0027c6f4aaa2..86f78a72b7f6 100644
--- a/sys-libs/glibc/glibc-2.36-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r7.ebuild
@@ -20,7 +20,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=8
+PATCH_VER=9
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-01-21 19:51 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-01-21 19:51 UTC (permalink / raw
  To: gentoo-commits

commit:     b20f2dd7443961f66ab0789d597c561d3d618803
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 21 19:50:42 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jan 21 19:51:19 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b20f2dd7

sys-libs/glibc: keyword 2.36-r7

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
index 86f78a72b7f6..7071aab6c547 100644
--- a/sys-libs/glibc/glibc-2.36-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r7.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-01-26 21:57 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-01-26 21:57 UTC (permalink / raw
  To: gentoo-commits

commit:     8bc459b38f9cdfa980e7fc6257b95cf08dbd2973
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 26 21:57:01 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Jan 26 21:57:36 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8bc459b3

sys-libs/glibc: Tests require mtrace and with that perl

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 33d217dc1787..76059f26c5dc 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -111,6 +111,7 @@ BDEPEND="
 		sys-apps/grep
 		app-alternatives/awk
 	)
+	test? ( dev-lang/perl )
 "
 COMMON_DEPEND="
 	gd? ( media-libs/gd:2= )
@@ -119,6 +120,7 @@ COMMON_DEPEND="
 		caps? ( sys-libs/libcap )
 	) )
 	perl? ( dev-lang/perl )
+	test? ( dev-lang/perl )
 	suid? ( caps? ( sys-libs/libcap ) )
 	selinux? ( sys-libs/libselinux )
 	systemtap? ( dev-util/systemtap )
@@ -1016,6 +1018,7 @@ glibc_do_configure() {
 		# execute Perl during configure if we're cross-compiling a prefix, but
 		# it will just disable mtrace in that case.
 		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl no)"
+		use test && ac_cv_path_PERL="${EPREFIX}/usr/bin/perl"
 
 		# locale data is arch-independent
 		# https://bugs.gentoo.org/753740


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-01-26 22:06 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-01-26 22:06 UTC (permalink / raw
  To: gentoo-commits

commit:     805a7923d1d845587bd38ea90808e605fbc2f1d6
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 26 22:06:13 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Jan 26 22:06:47 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=805a7923

sys-libs/glibc: fix that

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 76059f26c5dc..413594ad57c4 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1017,8 +1017,8 @@ glibc_do_configure() {
 		# up a Perl from outside the prefix instead. configure will fail to
 		# execute Perl during configure if we're cross-compiling a prefix, but
 		# it will just disable mtrace in that case.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl no)"
-		use test && ac_cv_path_PERL="${EPREFIX}/usr/bin/perl"
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl no))"
 
 		# locale data is arch-independent
 		# https://bugs.gentoo.org/753740


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-01-30 19:45 James Le Cuirot
  0 siblings, 0 replies; 1076+ messages in thread
From: James Le Cuirot @ 2023-01-30 19:45 UTC (permalink / raw
  To: gentoo-commits

commit:     41811e6dccc06d1760e3ede11d638f01c947fef1
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 30 19:44:31 2023 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Mon Jan 30 19:44:31 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=41811e6d

sys-libs/glibc: Backport prefix sysroot change to stable version

Sorry for changing the stable version, but I forgot to consider stable before
publishing the news item. This only affects prefix anyway.

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r5.ebuild | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.36-r5.ebuild b/sys-libs/glibc/glibc-2.36-r5.ebuild
index ed09d00c8a98..5aa15579a204 100644
--- a/sys-libs/glibc/glibc-2.36-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r5.ebuild
@@ -1306,6 +1306,17 @@ glibc_do_src_install() {
 		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
 	fi
 
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
 	# We'll take care of the cache ourselves
 	rm -f "${ED}"/etc/ld.so.cache
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-02-02 15:34 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-02-02 15:34 UTC (permalink / raw
  To: gentoo-commits

commit:     b811b2c7afc5220203ee43ec218a2ce614527a45
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  2 15:33:16 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Feb  2 15:34:20 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b811b2c7

sys-libs/glibc: version bump 2.37, unkeyworded

FAIL: math/test-float-y0
FAIL: math/test-float32-y0

Summary of test results:
      2 FAIL
   4745 PASS
     39 UNSUPPORTED
     19 XFAIL
      7 XPASS

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          |    2 +
 sys-libs/glibc/glibc-2.37.ebuild | 1650 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 1652 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 3d0e4a769fb0..558ce3b59c2e 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,6 +19,8 @@ DIST glibc-2.36-patches-5.tar.xz 81348 BLAKE2B 003a59a992302c21132474bcdc994d10b
 DIST glibc-2.36-patches-6.tar.xz 100540 BLAKE2B bdd887bd61c5c3f8047e31b1380344da82a5e9c7fe6cf0ebd1177a1dd40462872dd9507594b6669140a1a8c6c08ce3195a3f8d425ce5e2a2ff6e9b42d90c43ed SHA512 3a2620e87eba62d3276c5b09b97337bffe3a51bf23da243fb550f6f9dddb77008a7840ede32b7b1a7ff72e06b89981d9edf27026931a12fae8042002d8328358
 DIST glibc-2.36-patches-9.tar.xz 110440 BLAKE2B edc1aca9b7bc9ce64683e3bd905c9804b581af2d41191ae85e6f0e73d444672abe56bbb620373d31b20db8f84a2cb9ed4e1026e50ce5f287dac5c24752ee187a SHA512 1f1f85a439983b776229b924f9a8fd9aacf9efc869a212ff15b49e60627f37719b548d20b9ff1b80d88996bce115f44efdbecc6dce378a4247c6078ed7e6e1b4
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
+DIST glibc-2.37-patches-1.tar.xz 13704 BLAKE2B 0479e8068690fdc2a880c91cce35900aa6a2544805be22398a11840bc06e0da4f57a70f88418c535e1a9f9345abb154ccf9f6c574b50fdb4e04595f1741eaa5e SHA512 c22f0715a4ea48d8cef218a6c35b004bb999df747451fa911e45655ab34375871c18af604daf7ca2284ab1a0513828d950b55c953f685407615920f598aea308
+DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff

diff --git a/sys-libs/glibc/glibc-2.37.ebuild b/sys-libs/glibc/glibc-2.37.ebuild
new file mode 100644
index 000000000000..23a25b3e5e13
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.37.ebuild
@@ -0,0 +1,1650 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..11} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=1
+PATCH_DEV=dilfridge
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl 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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		app-alternatives/awk
+	)
+	test? ( dev-lang/perl )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	perl? ( dev-lang/perl )
+	test? ( dev-lang/perl )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		app-alternatives/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	app-alternatives/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection='
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl no))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-02-08 14:59 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-02-08 14:59 UTC (permalink / raw
  To: gentoo-commits

commit:     3f5305f584de1481159876f4c174aa87cfce1c89
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Feb  8 14:57:16 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Feb  8 14:59:08 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f5305f5

sys-libs/glibc: bump 2.37 to  patchset 2

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-2.37.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 558ce3b59c2e..a9750664915a 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,7 +19,7 @@ DIST glibc-2.36-patches-5.tar.xz 81348 BLAKE2B 003a59a992302c21132474bcdc994d10b
 DIST glibc-2.36-patches-6.tar.xz 100540 BLAKE2B bdd887bd61c5c3f8047e31b1380344da82a5e9c7fe6cf0ebd1177a1dd40462872dd9507594b6669140a1a8c6c08ce3195a3f8d425ce5e2a2ff6e9b42d90c43ed SHA512 3a2620e87eba62d3276c5b09b97337bffe3a51bf23da243fb550f6f9dddb77008a7840ede32b7b1a7ff72e06b89981d9edf27026931a12fae8042002d8328358
 DIST glibc-2.36-patches-9.tar.xz 110440 BLAKE2B edc1aca9b7bc9ce64683e3bd905c9804b581af2d41191ae85e6f0e73d444672abe56bbb620373d31b20db8f84a2cb9ed4e1026e50ce5f287dac5c24752ee187a SHA512 1f1f85a439983b776229b924f9a8fd9aacf9efc869a212ff15b49e60627f37719b548d20b9ff1b80d88996bce115f44efdbecc6dce378a4247c6078ed7e6e1b4
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
-DIST glibc-2.37-patches-1.tar.xz 13704 BLAKE2B 0479e8068690fdc2a880c91cce35900aa6a2544805be22398a11840bc06e0da4f57a70f88418c535e1a9f9345abb154ccf9f6c574b50fdb4e04595f1741eaa5e SHA512 c22f0715a4ea48d8cef218a6c35b004bb999df747451fa911e45655ab34375871c18af604daf7ca2284ab1a0513828d950b55c953f685407615920f598aea308
+DIST glibc-2.37-patches-2.tar.xz 18644 BLAKE2B 74b3cbfe5560b36588ffc25a39147f1aa68a8eeef504c0670b5ccee53fb78c68463185bfa85424a65f063983a50e813de6dc92209947c7f9c899a814aff18361 SHA512 52a14bc9380d710685239b09413aa41527797a5a87f1f905b2aedda582004a3d8cbf7ca1c8065c5dab8e782ff1020025f47629afcb1d0e3254976c8a6dc54433
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.37.ebuild b/sys-libs/glibc/glibc-2.37.ebuild
index 23a25b3e5e13..c9fe06ce176d 100644
--- a/sys-libs/glibc/glibc-2.37.ebuild
+++ b/sys-libs/glibc/glibc-2.37.ebuild
@@ -20,7 +20,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=1
+PATCH_VER=2
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-02-25 15:52 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-02-25 15:52 UTC (permalink / raw
  To: gentoo-commits

commit:     5c763bca6749bdf1bcacc175c796b9e7dbee437b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 25 15:51:02 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Feb 25 15:52:02 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5c763bca

sys-libs/glibc: bump 2.37 patchset to version 3

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          | 2 +-
 sys-libs/glibc/glibc-2.37.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index a9750664915a..bdd364448a50 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,7 +19,7 @@ DIST glibc-2.36-patches-5.tar.xz 81348 BLAKE2B 003a59a992302c21132474bcdc994d10b
 DIST glibc-2.36-patches-6.tar.xz 100540 BLAKE2B bdd887bd61c5c3f8047e31b1380344da82a5e9c7fe6cf0ebd1177a1dd40462872dd9507594b6669140a1a8c6c08ce3195a3f8d425ce5e2a2ff6e9b42d90c43ed SHA512 3a2620e87eba62d3276c5b09b97337bffe3a51bf23da243fb550f6f9dddb77008a7840ede32b7b1a7ff72e06b89981d9edf27026931a12fae8042002d8328358
 DIST glibc-2.36-patches-9.tar.xz 110440 BLAKE2B edc1aca9b7bc9ce64683e3bd905c9804b581af2d41191ae85e6f0e73d444672abe56bbb620373d31b20db8f84a2cb9ed4e1026e50ce5f287dac5c24752ee187a SHA512 1f1f85a439983b776229b924f9a8fd9aacf9efc869a212ff15b49e60627f37719b548d20b9ff1b80d88996bce115f44efdbecc6dce378a4247c6078ed7e6e1b4
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
-DIST glibc-2.37-patches-2.tar.xz 18644 BLAKE2B 74b3cbfe5560b36588ffc25a39147f1aa68a8eeef504c0670b5ccee53fb78c68463185bfa85424a65f063983a50e813de6dc92209947c7f9c899a814aff18361 SHA512 52a14bc9380d710685239b09413aa41527797a5a87f1f905b2aedda582004a3d8cbf7ca1c8065c5dab8e782ff1020025f47629afcb1d0e3254976c8a6dc54433
+DIST glibc-2.37-patches-3.tar.xz 22908 BLAKE2B 9b8bda29dc25a444dae9ace7e9c2c072f1f4b07a864720036d16be6d69e40b3c1d506838ce4168066eb490780a95222e8746efc42af4b4b2f2cf86483142294a SHA512 6e51300bfbd44d549dbf24de8a6d0137865e51ab5d9ebd85f638b17a8c7aa39b7842c3ace762649216060160b8937da9e384876c1202bc63b0291c2e564d2703
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.37.ebuild b/sys-libs/glibc/glibc-2.37.ebuild
index c9fe06ce176d..105fdc0c3aaa 100644
--- a/sys-libs/glibc/glibc-2.37.ebuild
+++ b/sys-libs/glibc/glibc-2.37.ebuild
@@ -20,7 +20,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=2
+PATCH_VER=3
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-02-28  3:33 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-02-28  3:33 UTC (permalink / raw
  To: gentoo-commits

commit:     f7386333115feaee9a8bf6ab314b0106ba77f196
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 28 03:33:23 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Feb 28 03:33:23 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f7386333

sys-libs/glibc: filter -fno-builtin

Makes no sense for glibc, as it's the thing providing the non-builtins.

Closes: https://bugs.gentoo.org/898098
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r7.ebuild | 3 +++
 sys-libs/glibc/glibc-2.37.ebuild    | 3 +++
 sys-libs/glibc/glibc-9999.ebuild    | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
index 6f93ac1992b1..4d0fecf5932c 100644
--- a/sys-libs/glibc/glibc-2.36-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r7.ebuild
@@ -440,6 +440,9 @@ setup_flags() {
 	# #492892
 	filter-flags -frecord-gcc-switches
 
+	# #898098
+	filter-flags -fno-builtin
+
 	# #829583
 	filter-lfs-flags
 

diff --git a/sys-libs/glibc/glibc-2.37.ebuild b/sys-libs/glibc/glibc-2.37.ebuild
index 105fdc0c3aaa..c7656cf6144e 100644
--- a/sys-libs/glibc/glibc-2.37.ebuild
+++ b/sys-libs/glibc/glibc-2.37.ebuild
@@ -442,6 +442,9 @@ setup_flags() {
 	# #492892
 	filter-flags -frecord-gcc-switches
 
+	# #898098
+	filter-flags -fno-builtin
+
 	# #829583
 	filter-lfs-flags
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 23a25b3e5e13..df348d783cb1 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -442,6 +442,9 @@ setup_flags() {
 	# #492892
 	filter-flags -frecord-gcc-switches
 
+	# #898098
+	filter-flags -fno-builtin
+
 	# #829583
 	filter-lfs-flags
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-03-10  7:25 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-03-10  7:25 UTC (permalink / raw
  To: gentoo-commits

commit:     65bbc208974e82689206465dd8c6c7b2beefe64b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 10 07:24:08 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 10 07:24:56 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65bbc208

sys-libs/glibc: backport perl/mtrace test fixes from 2.37 to 2.36

Closes: https://bugs.gentoo.org/895318
Closes: https://bugs.gentoo.org/900639
See: 805a7923d1d845587bd38ea90808e605fbc2f1d6
See: 8bc459b38f9cdfa980e7fc6257b95cf08dbd2973
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r6.ebuild | 5 ++++-
 sys-libs/glibc/glibc-2.36-r7.ebuild | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.36-r6.ebuild b/sys-libs/glibc/glibc-2.36-r6.ebuild
index e86bbd923123..d2e3e438e4a2 100644
--- a/sys-libs/glibc/glibc-2.36-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r6.ebuild
@@ -111,6 +111,7 @@ BDEPEND="
 		sys-apps/grep
 		app-alternatives/awk
 	)
+	test? ( dev-lang/perl )
 "
 COMMON_DEPEND="
 	gd? ( media-libs/gd:2= )
@@ -119,6 +120,7 @@ COMMON_DEPEND="
 		caps? ( sys-libs/libcap )
 	) )
 	perl? ( dev-lang/perl )
+	test? ( dev-lang/perl )
 	suid? ( caps? ( sys-libs/libcap ) )
 	selinux? ( sys-libs/libselinux )
 	systemtap? ( dev-util/systemtap )
@@ -1015,7 +1017,8 @@ glibc_do_configure() {
 		# up a Perl from outside the prefix instead. configure will fail to
 		# execute Perl during configure if we're cross-compiling a prefix, but
 		# it will just disable mtrace in that case.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl no)"
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl no))"
 
 		# locale data is arch-independent
 		# https://bugs.gentoo.org/753740

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
index 4d0fecf5932c..c0b4734c003a 100644
--- a/sys-libs/glibc/glibc-2.36-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r7.ebuild
@@ -111,6 +111,7 @@ BDEPEND="
 		sys-apps/grep
 		app-alternatives/awk
 	)
+	test? ( dev-lang/perl )
 "
 COMMON_DEPEND="
 	gd? ( media-libs/gd:2= )
@@ -119,6 +120,7 @@ COMMON_DEPEND="
 		caps? ( sys-libs/libcap )
 	) )
 	perl? ( dev-lang/perl )
+	test? ( dev-lang/perl )
 	suid? ( caps? ( sys-libs/libcap ) )
 	selinux? ( sys-libs/libselinux )
 	systemtap? ( dev-util/systemtap )
@@ -1018,7 +1020,8 @@ glibc_do_configure() {
 		# up a Perl from outside the prefix instead. configure will fail to
 		# execute Perl during configure if we're cross-compiling a prefix, but
 		# it will just disable mtrace in that case.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl no)"
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl no))"
 
 		# locale data is arch-independent
 		# https://bugs.gentoo.org/753740


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-03-10  8:08 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-03-10  8:08 UTC (permalink / raw
  To: gentoo-commits

commit:     bdf17d2cf86f3c1f7ee214811ed576672c70dddf
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 10 08:07:24 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 10 08:07:24 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bdf17d2c

sys-libs/glibc: Stabilize 2.36-r7 amd64, #893874

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
index c0b4734c003a..47019e59a218 100644
--- a/sys-libs/glibc/glibc-2.36-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r7.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-03-10  8:08 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-03-10  8:08 UTC (permalink / raw
  To: gentoo-commits

commit:     73e81a7a1a7487875d705dcfff6180adf5441fce
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 10 08:07:27 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 10 08:07:27 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=73e81a7a

sys-libs/glibc: Stabilize 2.36-r7 arm64, #893874

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
index 47019e59a218..8bb3e20062b4 100644
--- a/sys-libs/glibc/glibc-2.36-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r7.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-03-11 14:11 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-03-11 14:11 UTC (permalink / raw
  To: gentoo-commits

commit:     56b68f6ca96fbaeedb7cb1d1097945a6ed818aa9
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 11 14:10:13 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Mar 11 14:10:56 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=56b68f6c

sys-libs/glibc: revbump and rekeyword 2.37

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/{glibc-2.37.ebuild => glibc-2.37-r1.ebuild} | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37.ebuild b/sys-libs/glibc/glibc-2.37-r1.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.37.ebuild
rename to sys-libs/glibc/glibc-2.37-r1.ebuild
index c7656cf6144e..55b5a05c1ef8 100644
--- a/sys-libs/glibc/glibc-2.37.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r1.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-03-17  2:37 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-03-17  2:37 UTC (permalink / raw
  To: gentoo-commits

commit:     0b7eace724b0035856311008c95cc7fe18b8231b
Author:     Krzesimir Nowak <knowak <AT> microsoft <DOT> com>
AuthorDate: Fri Mar 17 02:34:21 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 17 02:35:53 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0b7eace7

sys-libs/glibc: disable CET explicitly if USE=-cet

When bootstrapping, we may have a situation where CET-enabled gcc from seed is
used to build CET-disabled glibc. As such, gcc implicitly enables CET if no
-fcf-protection flag is passed. For a typical package it should not be a problem,
but for glibc it matters as it is dealing with CET in ld.so. So if CET is supposed to be
disabled for glibc, be explicit about it.

[sam: cherry-picked from Flatcar at https://github.com/flatcar/coreos-overlay/commit/f4b92a6de9fcf506b30f1c6156b27c0e3d25438e]

Bug: https://bugs.gentoo.org/830454
Closes: https://bugs.gentoo.org/901363
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r7.ebuild | 13 ++++++++++++-
 sys-libs/glibc/glibc-2.37-r1.ebuild | 13 ++++++++++++-
 sys-libs/glibc/glibc-9999.ebuild    | 13 ++++++++++++-
 3 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
index 8bb3e20062b4..28002f738a95 100644
--- a/sys-libs/glibc/glibc-2.36-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r7.ebuild
@@ -472,7 +472,18 @@ setup_flags() {
 	filter-flags '-fsanitize=*'
 
 	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
 }
 
 use_multiarch() {

diff --git a/sys-libs/glibc/glibc-2.37-r1.ebuild b/sys-libs/glibc/glibc-2.37-r1.ebuild
index 55b5a05c1ef8..4b041ecc1f7e 100644
--- a/sys-libs/glibc/glibc-2.37-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r1.ebuild
@@ -472,7 +472,18 @@ setup_flags() {
 	filter-flags '-fsanitize=*'
 
 	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
 }
 
 use_multiarch() {

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index df348d783cb1..f5ec71d81a7b 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -472,7 +472,18 @@ setup_flags() {
 	filter-flags '-fsanitize=*'
 
 	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
 }
 
 use_multiarch() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-03-21 17:42 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-03-21 17:42 UTC (permalink / raw
  To: gentoo-commits

commit:     7c56fc08503c956e421bafd8d2a584a3902876da
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 21 17:41:12 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Mar 21 17:42:20 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c56fc08

sys-libs/glibc: Bump locale-gen version

Bug: https://bugs.gentoo.org/883457
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             | 1 +
 sys-libs/glibc/glibc-2.36-r7.ebuild | 2 +-
 sys-libs/glibc/glibc-2.37-r1.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 4 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index bdd364448a50..615418fa55f4 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -26,3 +26,4 @@ DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff
 DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db
 DIST locale-gen-2.22.tar.gz 7971 BLAKE2B 2dc66fa69bf51799d0c34459b654fba6998b80a7e322e9b670036c967e269ad921f50195e6e34c4a83c1f0bad191fd5aa3f37defb82271b73acbca07b7e49d08 SHA512 9798b10dbbc792345a7b7a121dec5f4bba9839a8aec010f01a09f3402fd5bf2376f79e03a6a19bc357010db780037a8811c381136ce19be1f1370374906dff38
+DIST locale-gen-2.23.tar.gz 7977 BLAKE2B bf2cc1fa05828a9133789133ce2d910662f1b5979269869cd76dac45831c45917700fc81357441fc7691af23196c6a6c3a28bb4440ceb6a5a3b17dbdc55c2bcc SHA512 f6b3daf3e2f10bc2f68626d8e7edc0f27eb0fe16bfe8840904a1b13d8fc76318d9f83277ee7fcb7a6db177413ba8a2cda94493e56d01df3a20ca37fed64e469c

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
index 28002f738a95..f66ef66ead99 100644
--- a/sys-libs/glibc/glibc-2.36-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r7.ebuild
@@ -35,7 +35,7 @@ RELEASE_VER=${PV}
 
 GCC_BOOTSTRAP_VER=20201208
 
-LOCALE_GEN_VER=2.22
+LOCALE_GEN_VER=2.23
 
 GLIBC_SYSTEMD_VER=20210729
 

diff --git a/sys-libs/glibc/glibc-2.37-r1.ebuild b/sys-libs/glibc/glibc-2.37-r1.ebuild
index 4b041ecc1f7e..c784be9ed0c3 100644
--- a/sys-libs/glibc/glibc-2.37-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r1.ebuild
@@ -35,7 +35,7 @@ RELEASE_VER=${PV}
 
 GCC_BOOTSTRAP_VER=20201208
 
-LOCALE_GEN_VER=2.22
+LOCALE_GEN_VER=2.23
 
 GLIBC_SYSTEMD_VER=20210729
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f5ec71d81a7b..aecbd287d248 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -35,7 +35,7 @@ RELEASE_VER=${PV}
 
 GCC_BOOTSTRAP_VER=20201208
 
-LOCALE_GEN_VER=2.22
+LOCALE_GEN_VER=2.23
 
 GLIBC_SYSTEMD_VER=20210729
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-03-21 17:44 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-03-21 17:44 UTC (permalink / raw
  To: gentoo-commits

commit:     d85e1219ef2c25ed445ea16e7375fe1cad1a1ef2
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 21 17:44:14 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Mar 21 17:44:14 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d85e1219

sys-libs/glibc: drop 2.36-r6

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.36-r6.ebuild | 1650 -----------------------------------
 2 files changed, 1651 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 615418fa55f4..d10419f46b76 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,7 +16,6 @@ DIST glibc-2.35-loongarch-patches-20220522.tar.xz 44728 BLAKE2B 09e7a061f3269ebd
 DIST glibc-2.35-patches-12.tar.xz 266056 BLAKE2B 7979dcfee270107d51c10e5ec74c9c1ab0d0a9743d6718a6d915d241fee6482958c957ef9fd25cd704925e3aa0d98c23115274c7594d149dec08c5e0766a488d SHA512 37a4c086b6a459cb378608a49d90705dddb806376edb2456b8c98e3a469fc558bce7b1b4c8a856b8dffb209e7b6e1c48382ed6f050284c5f74a92ca4f7d4b88a
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-2.36-patches-5.tar.xz 81348 BLAKE2B 003a59a992302c21132474bcdc994d10b5d50a94368e949ce28cbe389cefd104f66c48cb61a63d24e2f6db94d010e4220bda3fb5291d088cda88069b928c92e0 SHA512 6d6a16114df2223bf04729a79d12a52e41c9b8e756863c1acbb909dc34696958073604ced1b691579271218738511191ddf517e03a700d3948752c455201bcc4
-DIST glibc-2.36-patches-6.tar.xz 100540 BLAKE2B bdd887bd61c5c3f8047e31b1380344da82a5e9c7fe6cf0ebd1177a1dd40462872dd9507594b6669140a1a8c6c08ce3195a3f8d425ce5e2a2ff6e9b42d90c43ed SHA512 3a2620e87eba62d3276c5b09b97337bffe3a51bf23da243fb550f6f9dddb77008a7840ede32b7b1a7ff72e06b89981d9edf27026931a12fae8042002d8328358
 DIST glibc-2.36-patches-9.tar.xz 110440 BLAKE2B edc1aca9b7bc9ce64683e3bd905c9804b581af2d41191ae85e6f0e73d444672abe56bbb620373d31b20db8f84a2cb9ed4e1026e50ce5f287dac5c24752ee187a SHA512 1f1f85a439983b776229b924f9a8fd9aacf9efc869a212ff15b49e60627f37719b548d20b9ff1b80d88996bce115f44efdbecc6dce378a4247c6078ed7e6e1b4
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-2.37-patches-3.tar.xz 22908 BLAKE2B 9b8bda29dc25a444dae9ace7e9c2c072f1f4b07a864720036d16be6d69e40b3c1d506838ce4168066eb490780a95222e8746efc42af4b4b2f2cf86483142294a SHA512 6e51300bfbd44d549dbf24de8a6d0137865e51ab5d9ebd85f638b17a8c7aa39b7842c3ace762649216060160b8937da9e384876c1202bc63b0291c2e564d2703

diff --git a/sys-libs/glibc/glibc-2.36-r6.ebuild b/sys-libs/glibc/glibc-2.36-r6.ebuild
deleted file mode 100644
index d2e3e438e4a2..000000000000
--- a/sys-libs/glibc/glibc-2.36-r6.ebuild
+++ /dev/null
@@ -1,1650 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..11} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=6
-PATCH_DEV=dilfridge
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl 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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		app-alternatives/awk
-	)
-	test? ( dev-lang/perl )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	perl? ( dev-lang/perl )
-	test? ( dev-lang/perl )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		app-alternatives/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	app-alternatives/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl no))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-03-21 17:47 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-03-21 17:47 UTC (permalink / raw
  To: gentoo-commits

commit:     9ee5a1cd6f8da6d084b93b3dbd2e8022a147cfbf
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 21 17:45:34 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Mar 21 17:45:34 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9ee5a1cd

sys-libs/glibc: drop old openssh blocker

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index aecbd287d248..38cec1fa3414 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -139,7 +139,6 @@ RDEPEND="${COMMON_DEPEND}
 	app-alternatives/awk
 	sys-apps/gentoo-functions
 	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
 "
 
 RESTRICT="!test? ( test )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-04-01 16:34 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2023-04-01 16:34 UTC (permalink / raw
  To: gentoo-commits

commit:     e5adfe4d09b9b16501c945f3acaf38dd6b3362fa
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  1 16:33:14 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Apr  1 16:33:14 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5adfe4d

sys-libs/glibc: Stabilize 2.36-r7 hppa, #893874

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
index f66ef66ead99..b9fc5440c083 100644
--- a/sys-libs/glibc/glibc-2.36-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r7.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-04-01 16:34 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2023-04-01 16:34 UTC (permalink / raw
  To: gentoo-commits

commit:     57e6dd343250c5aee0403a250c360034a9341307
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  1 16:33:20 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Apr  1 16:33:20 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=57e6dd34

sys-libs/glibc: Stabilize 2.36-r7 ppc, #893874

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
index 99f6fae61679..0eb77d3cf6e8 100644
--- a/sys-libs/glibc/glibc-2.36-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r7.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-04-01 16:34 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2023-04-01 16:34 UTC (permalink / raw
  To: gentoo-commits

commit:     6f64c3fead796a52f8652beba0c2aacc12134006
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  1 16:33:23 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Apr  1 16:33:23 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f64c3fe

sys-libs/glibc: Stabilize 2.36-r7 ppc64, #893874

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
index 0eb77d3cf6e8..1888a31be9eb 100644
--- a/sys-libs/glibc/glibc-2.36-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r7.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-04-01 16:34 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2023-04-01 16:34 UTC (permalink / raw
  To: gentoo-commits

commit:     75185bd70b3b0b15ea69a2cde30d2621a6af45af
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  1 16:33:17 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Apr  1 16:33:17 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=75185bd7

sys-libs/glibc: Stabilize 2.36-r7 arm, #893874

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
index b9fc5440c083..99f6fae61679 100644
--- a/sys-libs/glibc/glibc-2.36-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r7.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-04-02 19:30 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2023-04-02 19:30 UTC (permalink / raw
  To: gentoo-commits

commit:     e9c7cfb07f90712355464c43252feec809b19d9c
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  2 19:30:07 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Apr  2 19:30:07 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e9c7cfb0

sys-libs/glibc: Stabilize 2.36-r7 x86, #893874

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
index 1888a31be9eb..a1fc54e6a531 100644
--- a/sys-libs/glibc/glibc-2.36-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r7.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-04-02 19:30 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2023-04-02 19:30 UTC (permalink / raw
  To: gentoo-commits

commit:     c424ffd4f3aa17ab9a9c07b26ce1b9f3bf92409e
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  2 19:30:10 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Apr  2 19:30:10 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c424ffd4

sys-libs/glibc: Stabilize 2.36-r7 sparc, #893874

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
index a1fc54e6a531..5f7cdcd38d87 100644
--- a/sys-libs/glibc/glibc-2.36-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r7.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-04-11  3:21 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-04-11  3:21 UTC (permalink / raw
  To: gentoo-commits

commit:     3657154456e0e218d34c29a129e6e917b1707036
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 11 03:20:23 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Apr 11 03:21:01 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=36571544

sys-libs/glibc: 2.36 and 2.37 patchset / revision bump

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 +
 sys-libs/glibc/glibc-2.36-r8.ebuild | 1664 +++++++++++++++++++++++++++++++++++
 sys-libs/glibc/glibc-2.37-r2.ebuild | 1664 +++++++++++++++++++++++++++++++++++
 3 files changed, 3330 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index d10419f46b76..f8c03e953e9d 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -15,10 +15,12 @@ DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8
 DIST glibc-2.35-loongarch-patches-20220522.tar.xz 44728 BLAKE2B 09e7a061f3269ebd763cd700f7c23e6cd7aab738d87ee31f76a81281920c4e5e207964c79104cd75f0a2e07b77344c2a730a9063344aa1483cd3d9aeac87de40 SHA512 21f13892fb52ec753856d5559b032c2be3a76d1cf940127222f7aa878548ce7e6ea0d2ff8791ddb91aaa2b77ce17131cd2fb2ebbdaa99443bf0a6b4c81f7388d
 DIST glibc-2.35-patches-12.tar.xz 266056 BLAKE2B 7979dcfee270107d51c10e5ec74c9c1ab0d0a9743d6718a6d915d241fee6482958c957ef9fd25cd704925e3aa0d98c23115274c7594d149dec08c5e0766a488d SHA512 37a4c086b6a459cb378608a49d90705dddb806376edb2456b8c98e3a469fc558bce7b1b4c8a856b8dffb209e7b6e1c48382ed6f050284c5f74a92ca4f7d4b88a
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
+DIST glibc-2.36-patches-10.tar.xz 118268 BLAKE2B 3d1bdb6c1a9e10ba78a344ca8940f68c49411a94aefd4d66bab17d784bc8783f2ae71efb171dea6d1919ea2c4a1f54333dabc2c4d99838ba8ec568484b84d0ae SHA512 b88dfc56ffc2df495e13cf90e709629db2b9b411a1c5ba6d39f40f45be3c2f49df7b1fe320d1cd7552515fe68dfc644c12916a6db34139ccf94ff755235d3a40
 DIST glibc-2.36-patches-5.tar.xz 81348 BLAKE2B 003a59a992302c21132474bcdc994d10b5d50a94368e949ce28cbe389cefd104f66c48cb61a63d24e2f6db94d010e4220bda3fb5291d088cda88069b928c92e0 SHA512 6d6a16114df2223bf04729a79d12a52e41c9b8e756863c1acbb909dc34696958073604ced1b691579271218738511191ddf517e03a700d3948752c455201bcc4
 DIST glibc-2.36-patches-9.tar.xz 110440 BLAKE2B edc1aca9b7bc9ce64683e3bd905c9804b581af2d41191ae85e6f0e73d444672abe56bbb620373d31b20db8f84a2cb9ed4e1026e50ce5f287dac5c24752ee187a SHA512 1f1f85a439983b776229b924f9a8fd9aacf9efc869a212ff15b49e60627f37719b548d20b9ff1b80d88996bce115f44efdbecc6dce378a4247c6078ed7e6e1b4
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-2.37-patches-3.tar.xz 22908 BLAKE2B 9b8bda29dc25a444dae9ace7e9c2c072f1f4b07a864720036d16be6d69e40b3c1d506838ce4168066eb490780a95222e8746efc42af4b4b2f2cf86483142294a SHA512 6e51300bfbd44d549dbf24de8a6d0137865e51ab5d9ebd85f638b17a8c7aa39b7842c3ace762649216060160b8937da9e384876c1202bc63b0291c2e564d2703
+DIST glibc-2.37-patches-4.tar.xz 24136 BLAKE2B 4dc69ed5d5671bc6a865775b86b4227015b7636f00a92b2c4ff07006fb2a288643eb6b5f6012dd34e62f6cf2f6bd63ac1931286b64fdac39e4988b21ca4b94ae SHA512 4bb5f4c3d37f7f028b8920bbda71c32492c1ebdfe4d151cb05e9ab14040d7b16833d4d9da06c5c84a9efde7510650c90a3c188d636e02ede46f8fe5e32b9b11f
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.36-r8.ebuild b/sys-libs/glibc/glibc-2.36-r8.ebuild
new file mode 100644
index 000000000000..abad004402d2
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.36-r8.ebuild
@@ -0,0 +1,1664 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..11} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=10
+PATCH_DEV=dilfridge
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+LOCALE_GEN_VER=2.23
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl 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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		app-alternatives/awk
+	)
+	test? ( dev-lang/perl )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	perl? ( dev-lang/perl )
+	test? ( dev-lang/perl )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		app-alternatives/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	app-alternatives/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl no))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}

diff --git a/sys-libs/glibc/glibc-2.37-r2.ebuild b/sys-libs/glibc/glibc-2.37-r2.ebuild
new file mode 100644
index 000000000000..f5b8b82c918c
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.37-r2.ebuild
@@ -0,0 +1,1664 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..11} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=4
+PATCH_DEV=dilfridge
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+RELEASE_VER=${PV}
+
+GCC_BOOTSTRAP_VER=20201208
+
+LOCALE_GEN_VER=2.23
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl 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
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+# gzip, grep, awk are needed by locale-gen, bug 740750
+
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
+	!compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		app-alternatives/awk
+	)
+	test? ( dev-lang/perl )
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	perl? ( dev-lang/perl )
+	test? ( dev-lang/perl )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		app-alternatives/awk
+	)
+	test? ( >=net-dns/libidn2-2.3.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+	app-arch/gzip
+	sys-apps/grep
+	app-alternatives/awk
+	sys-apps/gentoo-functions
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<net-misc/openssh-8.1_p1-r2
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	# Users have had a chance to phase themselves, time to give em the boot
+	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+		die "Lazy upgrader detected"
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}"
+	find . -name configure -exec touch {} +
+
+	# move the external locale-gen to its old place
+	mkdir extra || die
+	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
+
+	eprefixify extra/locale/locale-gen
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}"
+}
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl no))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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() {
+	local ret=0
+
+	glibc_src_test
+	: $(( ret |= $? ))
+
+	return ${ret}
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	# Give tests more time to complete.
+	export TIMEOUTFACTOR=5
+
+	foreach_abi do_src_test || die "tests failed"
+}
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+	cd "${WORKDIR}"/extra/locale
+	dosbin locale-gen
+	doman *.[0-8]
+	insinto /etc
+	doins locale.gen
+
+	keepdir /usr/lib/locale
+
+	cd "${S}"
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-04-13 22:58 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-04-13 22:58 UTC (permalink / raw
  To: gentoo-commits

commit:     d92b93c9a238d7ee31ab24a7be1a4d4a1ad1bdb2
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 13 22:57:07 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Apr 13 22:57:53 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d92b93c9

sys-libs/glibc: rekeyword 2.36-r8 and 2.37-r2

Bug: https://bugs.gentoo.org/895784
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r8.ebuild | 2 +-
 sys-libs/glibc/glibc-2.37-r2.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.36-r8.ebuild b/sys-libs/glibc/glibc-2.36-r8.ebuild
index abad004402d2..3bc43fe94843 100644
--- a/sys-libs/glibc/glibc-2.36-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi

diff --git a/sys-libs/glibc/glibc-2.37-r2.ebuild b/sys-libs/glibc/glibc-2.37-r2.ebuild
index f5b8b82c918c..6e9fa3dcb8b2 100644
--- a/sys-libs/glibc/glibc-2.37-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r2.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-04-22 21:14 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-04-22 21:14 UTC (permalink / raw
  To: gentoo-commits

commit:     ddcb84b3e329f4c570f0a2ca1c0af7d42698e748
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 22 21:14:04 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Apr 22 21:14:41 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ddcb84b3

sys-libs/glibc: drop 2.36-r5, 2.37-r1

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 -
 sys-libs/glibc/glibc-2.36-r5.ebuild | 1639 ----------------------------------
 sys-libs/glibc/glibc-2.37-r1.ebuild | 1664 -----------------------------------
 3 files changed, 3305 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index f8c03e953e9d..cc31b51d1f5d 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,10 +16,8 @@ DIST glibc-2.35-loongarch-patches-20220522.tar.xz 44728 BLAKE2B 09e7a061f3269ebd
 DIST glibc-2.35-patches-12.tar.xz 266056 BLAKE2B 7979dcfee270107d51c10e5ec74c9c1ab0d0a9743d6718a6d915d241fee6482958c957ef9fd25cd704925e3aa0d98c23115274c7594d149dec08c5e0766a488d SHA512 37a4c086b6a459cb378608a49d90705dddb806376edb2456b8c98e3a469fc558bce7b1b4c8a856b8dffb209e7b6e1c48382ed6f050284c5f74a92ca4f7d4b88a
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-2.36-patches-10.tar.xz 118268 BLAKE2B 3d1bdb6c1a9e10ba78a344ca8940f68c49411a94aefd4d66bab17d784bc8783f2ae71efb171dea6d1919ea2c4a1f54333dabc2c4d99838ba8ec568484b84d0ae SHA512 b88dfc56ffc2df495e13cf90e709629db2b9b411a1c5ba6d39f40f45be3c2f49df7b1fe320d1cd7552515fe68dfc644c12916a6db34139ccf94ff755235d3a40
-DIST glibc-2.36-patches-5.tar.xz 81348 BLAKE2B 003a59a992302c21132474bcdc994d10b5d50a94368e949ce28cbe389cefd104f66c48cb61a63d24e2f6db94d010e4220bda3fb5291d088cda88069b928c92e0 SHA512 6d6a16114df2223bf04729a79d12a52e41c9b8e756863c1acbb909dc34696958073604ced1b691579271218738511191ddf517e03a700d3948752c455201bcc4
 DIST glibc-2.36-patches-9.tar.xz 110440 BLAKE2B edc1aca9b7bc9ce64683e3bd905c9804b581af2d41191ae85e6f0e73d444672abe56bbb620373d31b20db8f84a2cb9ed4e1026e50ce5f287dac5c24752ee187a SHA512 1f1f85a439983b776229b924f9a8fd9aacf9efc869a212ff15b49e60627f37719b548d20b9ff1b80d88996bce115f44efdbecc6dce378a4247c6078ed7e6e1b4
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
-DIST glibc-2.37-patches-3.tar.xz 22908 BLAKE2B 9b8bda29dc25a444dae9ace7e9c2c072f1f4b07a864720036d16be6d69e40b3c1d506838ce4168066eb490780a95222e8746efc42af4b4b2f2cf86483142294a SHA512 6e51300bfbd44d549dbf24de8a6d0137865e51ab5d9ebd85f638b17a8c7aa39b7842c3ace762649216060160b8937da9e384876c1202bc63b0291c2e564d2703
 DIST glibc-2.37-patches-4.tar.xz 24136 BLAKE2B 4dc69ed5d5671bc6a865775b86b4227015b7636f00a92b2c4ff07006fb2a288643eb6b5f6012dd34e62f6cf2f6bd63ac1931286b64fdac39e4988b21ca4b94ae SHA512 4bb5f4c3d37f7f028b8920bbda71c32492c1ebdfe4d151cb05e9ab14040d7b16833d4d9da06c5c84a9efde7510650c90a3c188d636e02ede46f8fe5e32b9b11f
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238

diff --git a/sys-libs/glibc/glibc-2.36-r5.ebuild b/sys-libs/glibc/glibc-2.36-r5.ebuild
deleted file mode 100644
index 5aa15579a204..000000000000
--- a/sys-libs/glibc/glibc-2.36-r5.ebuild
+++ /dev/null
@@ -1,1639 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..11} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=5
-PATCH_DEV=dilfridge
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-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 hash-sysv-compat 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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		app-alternatives/awk
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		app-alternatives/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	app-alternatives/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection='
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.37-r1.ebuild b/sys-libs/glibc/glibc-2.37-r1.ebuild
deleted file mode 100644
index c784be9ed0c3..000000000000
--- a/sys-libs/glibc/glibc-2.37-r1.ebuild
+++ /dev/null
@@ -1,1664 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..11} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=3
-PATCH_DEV=dilfridge
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-LOCALE_GEN_VER=2.23
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl 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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		app-alternatives/awk
-	)
-	test? ( dev-lang/perl )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	perl? ( dev-lang/perl )
-	test? ( dev-lang/perl )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		app-alternatives/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	app-alternatives/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl no))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-05-01 14:07 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-05-01 14:07 UTC (permalink / raw
  To: gentoo-commits

commit:     418c0253c76b125a32b23fdf3978d34cf0f334e1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon May  1 14:06:48 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon May  1 14:07:17 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=418c0253

sys-libs/glibc: enable py3.10 and enable py3.11 for older

Seem to build OK. Not seeing any relevant upstream fixes either.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r7.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.32-r8.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.33-r14.ebuild | 5 +----
 sys-libs/glibc/glibc-2.34-r14.ebuild | 2 +-
 4 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index ed89b5d2c414..d09dc4ea364b 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_9 )
+PYTHON_COMPAT=( python3_{9..11} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix toolchain-funcs flag-o-matic gnuconfig \

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index 37570a1d83f1..a47f34293b2c 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_9 )
+PYTHON_COMPAT=( python3_{9..11} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix toolchain-funcs flag-o-matic gnuconfig \

diff --git a/sys-libs/glibc/glibc-2.33-r14.ebuild b/sys-libs/glibc/glibc-2.33-r14.ebuild
index 779c3d60399b..34f2323a5505 100644
--- a/sys-libs/glibc/glibc-2.33-r14.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r14.ebuild
@@ -6,10 +6,7 @@ EAPI=7
 # Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
 # Please read & adapt the page as necessary if obsolete.
 
-# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies
-# on upgrades as people migrate to libxcrypt.
-# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
-PYTHON_COMPAT=( python3_9 )
+PYTHON_COMPAT=( python3_{9..11} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \

diff --git a/sys-libs/glibc/glibc-2.34-r14.ebuild b/sys-libs/glibc/glibc-2.34-r14.ebuild
index 28455719976d..52c68a1cd29d 100644
--- a/sys-libs/glibc/glibc-2.34-r14.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r14.ebuild
@@ -6,7 +6,7 @@ EAPI=7
 # Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
 # Please read & adapt the page as necessary if obsolete.
 
-PYTHON_COMPAT=( python3_{9..10} )
+PYTHON_COMPAT=( python3_{9..11} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-05-06 22:21 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-05-06 22:21 UTC (permalink / raw
  To: gentoo-commits

commit:     983fd58eed663ef31adbaa26d512710de64d1b4f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat May  6 22:20:18 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat May  6 22:20:53 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=983fd58e

sys-libs/glibc: update EAPI 7 -> 8, cleanups, minor improvements

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 104 ++++++++++++++++++++-------------------
 1 file changed, 53 insertions(+), 51 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 38cec1fa3414..3a3b70d0d31b 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1,7 +1,7 @@
 # Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=8
 
 # Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
 # Please read & adapt the page as necessary if obsolete.
@@ -23,6 +23,22 @@ EMULTILIB_PKG="true"
 PATCH_VER=1
 PATCH_DEV=dilfridge
 
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# locale-gen version
+LOCALE_GEN_VER=2.23
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
@@ -31,26 +47,12 @@ else
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi
 
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-LOCALE_GEN_VER=2.23
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl 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
 #  CHOST   - machine that will host the binaries
@@ -99,18 +101,21 @@ fi
 # Lastly, let's avoid some openssh nastiness, bug 708224, as
 # convenience to our users.
 
-# gzip, grep, awk are needed by locale-gen, bug 740750
+# gzip, grep, awk are needed by locale-gen, bug 740750; depending on the
+# compile-locales useflag either in src_install or in pkg_postinst.
 
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
+IDEPEND="
 	!compile-locales? (
 		app-arch/gzip
 		sys-apps/grep
 		app-alternatives/awk
 	)
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	doc? ( sys-apps/texinfo )
 	test? ( dev-lang/perl )
 "
 COMMON_DEPEND="
@@ -670,7 +675,7 @@ foreach_abi() {
 
 glibc_banner() {
 	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
 	echo "${b}"
 }
 
@@ -766,13 +771,6 @@ sanity_prechecks() {
 		fi
 	fi
 
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
 	if [[ ${CTARGET} == i386-* ]] ; then
 		eerror "i386 CHOSTs are no longer supported."
 		eerror "Chances are you don't actually want/need i386."
@@ -879,6 +877,8 @@ pkg_pretend() {
 	upgrade_warning
 }
 
+# pkg_setup
+
 pkg_setup() {
 	# see bug 682570
 	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
@@ -907,7 +907,7 @@ src_unpack() {
 		unpack ${P}.tar.xz
 
 		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
 	fi
 
 	cd "${WORKDIR}" || die
@@ -915,15 +915,17 @@ src_unpack() {
 	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
 }
 
+# src_prepare
+
 src_prepare() {
 	local patchsetname
 	if ! use vanilla ; then
 		if [[ ${PV} == 9999* ]] ; then
 			patchsetname="from git master"
 		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
+			patchsetname="${PV}-${PATCH_VER}"
 		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
 		eapply "${WORKDIR}"/patches
 		einfo "Done."
 	fi
@@ -932,7 +934,7 @@ src_prepare() {
 
 	gnuconfig_update
 
-	cd "${WORKDIR}"
+	cd "${WORKDIR}" || die
 	find . -name configure -exec touch {} +
 
 	# move the external locale-gen to its old place
@@ -944,9 +946,11 @@ src_prepare() {
 	# Fix permissions on some of the scripts.
 	chmod u+x "${S}"/scripts/*.sh
 
-	cd "${S}"
+	cd "${S}" || die
 }
 
+# src_configure
+
 glibc_do_configure() {
 	dump_build_environment
 
@@ -962,7 +966,7 @@ glibc_do_configure() {
 	#    https://sourceware.org/PR22634#c0
 	case $(tc-arch ${CTARGET}) in
 		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
 		# Blacklist everywhere else
 		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
 	esac
@@ -1040,6 +1044,7 @@ glibc_do_configure() {
 		# -march= option tricks build system to infer too
 		# high ISA level: https://sourceware.org/PR27318
 		libc_cv_include_x86_isa_level=no
+
 		# Explicit override of https://sourceware.org/PR27991
 		# exposes a bug in glibc's configure:
 		# https://sourceware.org/PR27991
@@ -1219,6 +1224,8 @@ src_configure() {
 	foreach_abi do_src_configure
 }
 
+# src_compile
+
 do_src_compile() {
 	emake -C "$(builddir nptl)"
 }
@@ -1231,6 +1238,8 @@ src_compile() {
 	foreach_abi do_src_compile
 }
 
+# src_test
+
 glibc_src_test() {
 	cd "$(builddir nptl)"
 
@@ -1250,26 +1259,16 @@ glibc_src_test() {
 	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=16 emake ${myxfailparams} check
 }
 
-do_src_test() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
 src_test() {
 	if just_headers ; then
 		return
 	fi
 
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
+	foreach_abi glibc_src_test || die "tests failed"
 }
 
+# src_install
+
 run_locale_gen() {
 	# if the host locales.gen contains no entries, we'll install everything
 	local root="$1"
@@ -1317,7 +1316,8 @@ glibc_do_src_install() {
 	# Avoid stripping binaries not targeted by ${CHOST}. Or else
 	# ${CHOST}-strip would break binaries build for ${CTARGET}.
 	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
 	# See Note [Disable automatic stripping]
 	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
 
@@ -1435,6 +1435,8 @@ glibc_do_src_install() {
 
 	#################################################################
 	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
 	# Make sure we install some symlink hacks so that when we build
 	# a 2nd stage cross-compiler, gcc finds the target system
 	# headers correctly.  See gcc/doc/gccinstall.info
@@ -1458,7 +1460,7 @@ glibc_do_src_install() {
 		-e "s: \\\\::g" -e "s:/: :g" \
 		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
 		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
+	cd "${WORKDIR}"/extra/locale || die
 	dosbin locale-gen
 	doman *.[0-8]
 	insinto /etc
@@ -1466,7 +1468,7 @@ glibc_do_src_install() {
 
 	keepdir /usr/lib/locale
 
-	cd "${S}"
+	cd "${S}" || die
 
 	# Install misc network config files
 	insinto /etc


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-05-06 22:29 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-05-06 22:29 UTC (permalink / raw
  To: gentoo-commits

commit:     4d2dfbde8b72aac769827dc0cbbb415af86f8004
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat May  6 22:28:31 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat May  6 22:28:31 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4d2dfbde

sys-libs/glibc: Enable perl also for USE=doc

Closes: https://bugs.gentoo.org/904344
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r2.ebuild | 3 ++-
 sys-libs/glibc/glibc-9999.ebuild    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.37-r2.ebuild b/sys-libs/glibc/glibc-2.37-r2.ebuild
index 6e9fa3dcb8b2..3b760ddcf5b3 100644
--- a/sys-libs/glibc/glibc-2.37-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r2.ebuild
@@ -131,6 +131,7 @@ DEPEND="${COMMON_DEPEND}
 		sys-apps/grep
 		app-alternatives/awk
 	)
+	doc? ( dev-lang/perl )
 	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
@@ -1032,7 +1033,7 @@ glibc_do_configure() {
 		# execute Perl during configure if we're cross-compiling a prefix, but
 		# it will just disable mtrace in that case.
 		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl no))"
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
 
 		# locale data is arch-independent
 		# https://bugs.gentoo.org/753740

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 3a3b70d0d31b..e98524b6b6c8 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -136,6 +136,7 @@ DEPEND="${COMMON_DEPEND}
 		sys-apps/grep
 		app-alternatives/awk
 	)
+	doc? ( dev-lang/perl )
 	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
@@ -1035,7 +1036,7 @@ glibc_do_configure() {
 		# execute Perl during configure if we're cross-compiling a prefix, but
 		# it will just disable mtrace in that case.
 		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl no))"
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
 
 		# locale data is arch-independent
 		# https://bugs.gentoo.org/753740


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-05-06 22:46 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-05-06 22:46 UTC (permalink / raw
  To: gentoo-commits

commit:     7136745d79a64d955e30a114c0874240d0f274bb
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat May  6 22:44:58 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat May  6 22:44:58 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7136745d

sys-libs/glibc: Try to sort out dependencies

Closes: https://bugs.gentoo.org/740750
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index e98524b6b6c8..c818e4aee8aa 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -115,8 +115,19 @@ BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
 	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	test? ( dev-lang/perl )
+	compile-locales? (
+		app-arch/gzip
+		sys-apps/grep
+		app-alternatives/awk
+	)
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
 "
 COMMON_DEPEND="
 	gd? ( media-libs/gd:2= )
@@ -124,27 +135,16 @@ COMMON_DEPEND="
 		audit? ( sys-process/audit )
 		caps? ( sys-libs/libcap )
 	) )
-	perl? ( dev-lang/perl )
-	test? ( dev-lang/perl )
 	suid? ( caps? ( sys-libs/libcap ) )
 	selinux? ( sys-libs/libselinux )
 	systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		app-alternatives/awk
-	)
-	doc? ( dev-lang/perl )
-	test? ( >=net-dns/libidn2-2.3.0 )
 "
 RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	app-alternatives/awk
 	sys-apps/gentoo-functions
 	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
 "
 
 RESTRICT="!test? ( test )"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-05-07  0:02 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-05-07  0:02 UTC (permalink / raw
  To: gentoo-commits

commit:     2cb5d0e2319f88c99f7a1a55b74fea0a3066a6d2
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun May  7 00:01:43 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun May  7 00:02:07 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2cb5d0e2

sys-libs/glibc: switch to external locale-gen

Bug: https://bugs.gentoo.org/903649
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 33 +++------------------------------
 1 file changed, 3 insertions(+), 30 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index c818e4aee8aa..2375fd18f6a9 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -26,9 +26,6 @@ PATCH_DEV=dilfridge
 # gcc mulitilib bootstrap files version
 GCC_BOOTSTRAP_VER=20201208
 
-# locale-gen version
-LOCALE_GEN_VER=2.23
-
 # systemd integration version
 GLIBC_SYSTEMD_VER=20210729
 
@@ -47,7 +44,6 @@ else
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi
 
-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 )"
 
@@ -105,21 +101,13 @@ fi
 # compile-locales useflag either in src_install or in pkg_postinst.
 
 IDEPEND="
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		app-alternatives/awk
-	)
+	!compile-locales? ( sys-apps/locale-gen )
 "
 BDEPEND="
 	${PYTHON_DEPS}
 	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
 	sys-devel/bison
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		app-alternatives/awk
-	)
+	compile-locales? ( sys-apps/locale-gen )
 	doc? (
 		dev-lang/perl
 		sys-apps/texinfo
@@ -142,7 +130,7 @@ COMMON_DEPEND="
 DEPEND="${COMMON_DEPEND}
 "
 RDEPEND="${COMMON_DEPEND}
-	sys-apps/gentoo-functions
+	sys-apps/locale-gen
 	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
 	perl? ( dev-lang/perl )
 "
@@ -912,7 +900,6 @@ src_unpack() {
 	fi
 
 	cd "${WORKDIR}" || die
-	unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
 	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
 }
 
@@ -938,12 +925,6 @@ src_prepare() {
 	cd "${WORKDIR}" || die
 	find . -name configure -exec touch {} +
 
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
 	# Fix permissions on some of the scripts.
 	chmod u+x "${S}"/scripts/*.sh
 
@@ -1461,13 +1442,6 @@ glibc_do_src_install() {
 		-e "s: \\\\::g" -e "s:/: :g" \
 		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
 		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale || die
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
 
 	cd "${S}" || die
 
@@ -1514,7 +1488,6 @@ glibc_do_src_install() {
 	# Generate all locales if this is a native build as locale generation
 	if use compile-locales && ! is_crosscompile ; then
 		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
 	fi
 }
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-05-07 16:03 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-05-07 16:03 UTC (permalink / raw
  To: gentoo-commits

commit:     1db5932753761897726caa736378b808452475bd
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun May  7 16:02:21 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun May  7 16:02:32 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1db59327

sys-libs/glibc: add explicit filter-lto post-strip-flags change

See e6dd349ea37663f3e3a6ce1df3fd9f7cf18e20cd.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r2.ebuild  | 3 ++-
 sys-libs/glibc/glibc-2.31-r7.ebuild  | 1 +
 sys-libs/glibc/glibc-2.32-r8.ebuild  | 1 +
 sys-libs/glibc/glibc-2.33-r14.ebuild | 1 +
 sys-libs/glibc/glibc-2.34-r14.ebuild | 1 +
 sys-libs/glibc/glibc-2.35-r11.ebuild | 1 +
 sys-libs/glibc/glibc-2.36-r7.ebuild  | 1 +
 sys-libs/glibc/glibc-2.36-r8.ebuild  | 1 +
 sys-libs/glibc/glibc-2.37-r2.ebuild  | 1 +
 sys-libs/glibc/glibc-9999.ebuild     | 1 +
 10 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r2.ebuild
index d1dff3cf1b44..998335c88426 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -335,6 +335,7 @@ setup_flags() {
 	# problems as possible.
 	strip-flags
 	strip-unsupported-flags
+	filter-lto
 	filter-flags -m32 -m64 '-mabi=*'
 
 	# glibc aborts if rpath is set by LDFLAGS

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index d09dc4ea364b..78cb09bec8e9 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -367,6 +367,7 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
+		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index a47f34293b2c..3d72cb214594 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -384,6 +384,7 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
+		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2

diff --git a/sys-libs/glibc/glibc-2.33-r14.ebuild b/sys-libs/glibc/glibc-2.33-r14.ebuild
index 34f2323a5505..1f432881eeeb 100644
--- a/sys-libs/glibc/glibc-2.33-r14.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r14.ebuild
@@ -396,6 +396,7 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
+		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2

diff --git a/sys-libs/glibc/glibc-2.34-r14.ebuild b/sys-libs/glibc/glibc-2.34-r14.ebuild
index 52c68a1cd29d..544d8be04150 100644
--- a/sys-libs/glibc/glibc-2.34-r14.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r14.ebuild
@@ -399,6 +399,7 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
+		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2

diff --git a/sys-libs/glibc/glibc-2.35-r11.ebuild b/sys-libs/glibc/glibc-2.35-r11.ebuild
index a986aee52894..5b6649f3f6de 100644
--- a/sys-libs/glibc/glibc-2.35-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r11.ebuild
@@ -412,6 +412,7 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
+		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
index 5f7cdcd38d87..49ab641a06f2 100644
--- a/sys-libs/glibc/glibc-2.36-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r7.ebuild
@@ -418,6 +418,7 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
+		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2

diff --git a/sys-libs/glibc/glibc-2.36-r8.ebuild b/sys-libs/glibc/glibc-2.36-r8.ebuild
index 3bc43fe94843..f8ee4287b7a4 100644
--- a/sys-libs/glibc/glibc-2.36-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r8.ebuild
@@ -418,6 +418,7 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
+		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2

diff --git a/sys-libs/glibc/glibc-2.37-r2.ebuild b/sys-libs/glibc/glibc-2.37-r2.ebuild
index 3b760ddcf5b3..5c8351a2a379 100644
--- a/sys-libs/glibc/glibc-2.37-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r2.ebuild
@@ -419,6 +419,7 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
+		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2375fd18f6a9..f16a004cdc94 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -411,6 +411,7 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
+		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-05-07 21:31 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-05-07 21:31 UTC (permalink / raw
  To: gentoo-commits

commit:     a24dfdd4b518e5d196337ffd03ce2ab8f304591d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun May  7 21:30:39 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun May  7 21:31:04 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a24dfdd4

sys-libs/glibc: Fix parallelization during binpkg install

Bug: https://bugs.gentoo.org/736794
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f16a004cdc94..cc98168d7f92 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1271,7 +1271,15 @@ run_locale_gen() {
 		locale_list="${root%/}/usr/share/i18n/SUPPORTED"
 	fi
 
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
 		--destdir "${root}"
 	echo "$@"
 	"$@"


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-05-07 21:51 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-05-07 21:51 UTC (permalink / raw
  To: gentoo-commits

commit:     af3e8eb1d66ca412e395e6e473f4d74552550494
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun May  7 21:50:24 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun May  7 21:50:51 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=af3e8eb1

sys-libs/glibc: Add a call to sanity_prechecks in pkg_preinst

Bug: https://bugs.gentoo.org/885481
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index cc98168d7f92..7f2028de0877 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1576,6 +1576,9 @@ pkg_preinst() {
 	# nothing to do if just installing headers
 	just_headers && return
 
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
 	# prepare /etc/ld.so.conf.d/ for files
 	mkdir -p "${EROOT}"/etc/ld.so.conf.d
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-05-08 21:29 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-05-08 21:29 UTC (permalink / raw
  To: gentoo-commits

commit:     52550140979f0ea48acd4dde2b6c7ef292629e28
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon May  8 21:28:54 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon May  8 21:29:33 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=52550140

sys-libs/glibc: drop locale-gen from RDEPEND

Bug: https://bugs.gentoo.org/903649
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 7f2028de0877..f2b018ef4bf1 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -130,7 +130,6 @@ COMMON_DEPEND="
 DEPEND="${COMMON_DEPEND}
 "
 RDEPEND="${COMMON_DEPEND}
-	sys-apps/locale-gen
 	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
 	perl? ( dev-lang/perl )
 "


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-05-09 20:59 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-05-09 20:59 UTC (permalink / raw
  To: gentoo-commits

commit:     9b52c49eec1464787e13aedddcf1b9b999a93c29
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue May  9 20:56:23 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue May  9 20:59:48 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9b52c49e

sys-libs/glibc: 2.37 patchset 5 bump, other modernization, split out locale-gen

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest                                    | 1 +
 sys-libs/glibc/{glibc-9999.ebuild => glibc-2.37-r3.ebuild} | 5 +----
 sys-libs/glibc/glibc-9999.ebuild                           | 3 ---
 3 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index cc31b51d1f5d..404ff5d96519 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,6 +19,7 @@ DIST glibc-2.36-patches-10.tar.xz 118268 BLAKE2B 3d1bdb6c1a9e10ba78a344ca8940f68
 DIST glibc-2.36-patches-9.tar.xz 110440 BLAKE2B edc1aca9b7bc9ce64683e3bd905c9804b581af2d41191ae85e6f0e73d444672abe56bbb620373d31b20db8f84a2cb9ed4e1026e50ce5f287dac5c24752ee187a SHA512 1f1f85a439983b776229b924f9a8fd9aacf9efc869a212ff15b49e60627f37719b548d20b9ff1b80d88996bce115f44efdbecc6dce378a4247c6078ed7e6e1b4
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-2.37-patches-4.tar.xz 24136 BLAKE2B 4dc69ed5d5671bc6a865775b86b4227015b7636f00a92b2c4ff07006fb2a288643eb6b5f6012dd34e62f6cf2f6bd63ac1931286b64fdac39e4988b21ca4b94ae SHA512 4bb5f4c3d37f7f028b8920bbda71c32492c1ebdfe4d151cb05e9ab14040d7b16833d4d9da06c5c84a9efde7510650c90a3c188d636e02ede46f8fe5e32b9b11f
+DIST glibc-2.37-patches-5.tar.xz 37640 BLAKE2B a87fb239208eb6d65c96bf7687570d8d0919277410fe1e28c293fa7749ffa862417bc1fe6d0819e47a806b20e52d14de84b843fa879fe15b884b2742719caf87 SHA512 344276606b7330322df72ee964d3447d02907df92b5a1d20b9aa427e93727be907f915ecd62db45e994c46451bd09d5da95ef7bf1a27d247a57589c568e6cb20
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.37-r3.ebuild
similarity index 99%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.37-r3.ebuild
index f2b018ef4bf1..c6b24c8364c1 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r3.ebuild
@@ -20,7 +20,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=1
+PATCH_VER=5
 PATCH_DEV=dilfridge
 
 # gcc mulitilib bootstrap files version
@@ -97,9 +97,6 @@ fi
 # Lastly, let's avoid some openssh nastiness, bug 708224, as
 # convenience to our users.
 
-# gzip, grep, awk are needed by locale-gen, bug 740750; depending on the
-# compile-locales useflag either in src_install or in pkg_postinst.
-
 IDEPEND="
 	!compile-locales? ( sys-apps/locale-gen )
 "

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f2b018ef4bf1..54fcf643e2cf 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -97,9 +97,6 @@ fi
 # Lastly, let's avoid some openssh nastiness, bug 708224, as
 # convenience to our users.
 
-# gzip, grep, awk are needed by locale-gen, bug 740750; depending on the
-# compile-locales useflag either in src_install or in pkg_postinst.
-
 IDEPEND="
 	!compile-locales? ( sys-apps/locale-gen )
 "


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-05-10 19:15 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-05-10 19:15 UTC (permalink / raw
  To: gentoo-commits

commit:     8686f981cd3d2c54826f377138ff793295c5e15d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed May 10 19:14:22 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed May 10 19:14:54 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8686f981

sys-libs/glibc: keyword 2.37-r3

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r3.ebuild b/sys-libs/glibc/glibc-2.37-r3.ebuild
index c6b24c8364c1..df775e7f1f85 100644
--- a/sys-libs/glibc/glibc-2.37-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r3.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-05-12  1:14 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-05-12  1:14 UTC (permalink / raw
  To: gentoo-commits

commit:     8f976c89bb93a17e59cd5121370e097b821d9943
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri May 12 01:14:18 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 12 01:14:18 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8f976c89

sys-libs/glibc: Stabilize 2.36-r8 amd64, #895784

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r8.ebuild b/sys-libs/glibc/glibc-2.36-r8.ebuild
index f8ee4287b7a4..2b3e5bc268e7 100644
--- a/sys-libs/glibc/glibc-2.36-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-05-16 20:02 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-05-16 20:02 UTC (permalink / raw
  To: gentoo-commits

commit:     d0a2daa418ed2783c4d46b5859985e4d137766bc
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Tue May 16 19:52:23 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue May 16 20:02:12 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d0a2daa4

sys-libs/glibc: stable 2.36-r8 for hppa, bug #895784

Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r8.ebuild b/sys-libs/glibc/glibc-2.36-r8.ebuild
index 2b3e5bc268e7..e042679aed82 100644
--- a/sys-libs/glibc/glibc-2.36-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-06-26 11:28 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-06-26 11:28 UTC (permalink / raw
  To: gentoo-commits

commit:     feafc2f0ca2c4852b14c16d93d0b871baa4de86a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 26 11:28:04 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 26 11:28:04 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=feafc2f0

sys-libs/glibc: Stabilize 2.36-r8 ppc64, #895784

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r8.ebuild b/sys-libs/glibc/glibc-2.36-r8.ebuild
index 5bfca280432a..de7c42482f8d 100644
--- a/sys-libs/glibc/glibc-2.36-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-06-26 11:28 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-06-26 11:28 UTC (permalink / raw
  To: gentoo-commits

commit:     f3d6f6ccef5c49f38fccb3c0c27cf5dbf0b3459a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 26 11:28:07 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 26 11:28:07 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f3d6f6cc

sys-libs/glibc: Stabilize 2.36-r8 sparc, #895784

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r8.ebuild b/sys-libs/glibc/glibc-2.36-r8.ebuild
index de7c42482f8d..2945011850ba 100644
--- a/sys-libs/glibc/glibc-2.36-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-06-26 11:28 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-06-26 11:28 UTC (permalink / raw
  To: gentoo-commits

commit:     4c0387ce5048e8578a5c0b321a9067c34c2e5c7c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 26 11:27:58 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 26 11:27:58 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4c0387ce

sys-libs/glibc: Stabilize 2.36-r8 arm64, #895784

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r8.ebuild b/sys-libs/glibc/glibc-2.36-r8.ebuild
index 75205901fe64..d5015a961c9d 100644
--- a/sys-libs/glibc/glibc-2.36-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-06-26 11:28 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-06-26 11:28 UTC (permalink / raw
  To: gentoo-commits

commit:     1bbd2901b4a5d286210d583683690e05a10709dc
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 26 11:28:10 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 26 11:28:10 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1bbd2901

sys-libs/glibc: Stabilize 2.36-r8 x86, #895784

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r8.ebuild b/sys-libs/glibc/glibc-2.36-r8.ebuild
index 2945011850ba..dc181a1690f3 100644
--- a/sys-libs/glibc/glibc-2.36-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-06-26 11:28 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-06-26 11:28 UTC (permalink / raw
  To: gentoo-commits

commit:     05ccd24f78e94492145351f8b5428c3b9c60824f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 26 11:28:01 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 26 11:28:01 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=05ccd24f

sys-libs/glibc: Stabilize 2.36-r8 ppc, #895784

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r8.ebuild b/sys-libs/glibc/glibc-2.36-r8.ebuild
index d5015a961c9d..5bfca280432a 100644
--- a/sys-libs/glibc/glibc-2.36-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-06-26 11:28 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-06-26 11:28 UTC (permalink / raw
  To: gentoo-commits

commit:     62330bd0777c40ff57f93a1fe9bd43d2b797a189
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 26 11:27:55 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 26 11:27:55 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=62330bd0

sys-libs/glibc: Stabilize 2.36-r8 arm, #895784

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.36-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.36-r8.ebuild b/sys-libs/glibc/glibc-2.36-r8.ebuild
index e042679aed82..75205901fe64 100644
--- a/sys-libs/glibc/glibc-2.36-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r8.ebuild
@@ -26,7 +26,7 @@ PATCH_DEV=dilfridge
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-06-26 15:32 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-06-26 15:32 UTC (permalink / raw
  To: gentoo-commits

commit:     4913f0a16e3cf0065d7e6de18e414882423f7d72
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 26 15:31:49 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 26 15:31:49 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4913f0a1

sys-libs/glibc: always filter-lto, even w/ USE=custom-cflags

Closes: https://bugs.gentoo.org/909193
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.31-r7.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.32-r8.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.33-r14.ebuild | 2 +-
 sys-libs/glibc/glibc-2.34-r14.ebuild | 2 +-
 sys-libs/glibc/glibc-2.35-r11.ebuild | 2 +-
 sys-libs/glibc/glibc-2.36-r7.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.36-r8.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.37-r2.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.37-r3.ebuild  | 2 +-
 sys-libs/glibc/glibc-9999.ebuild     | 2 +-
 10 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index 78cb09bec8e9..ff102e83e4d2 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -367,12 +367,12 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
-		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2
 	fi
 	strip-unsupported-flags
+	filter-lto
 	filter-flags -m32 -m64 '-mabi=*'
 
 	# glibc aborts if rpath is set by LDFLAGS

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index 3d72cb214594..83c994830e78 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -384,12 +384,12 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
-		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2
 	fi
 	strip-unsupported-flags
+	filter-lto
 	filter-flags -m32 -m64 '-mabi=*'
 
 	# glibc aborts if rpath is set by LDFLAGS

diff --git a/sys-libs/glibc/glibc-2.33-r14.ebuild b/sys-libs/glibc/glibc-2.33-r14.ebuild
index 1f432881eeeb..817ff95e7869 100644
--- a/sys-libs/glibc/glibc-2.33-r14.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r14.ebuild
@@ -396,12 +396,12 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
-		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2
 	fi
 	strip-unsupported-flags
+	filter-lto
 	filter-flags -m32 -m64 '-mabi=*'
 
 	# glibc aborts if rpath is set by LDFLAGS

diff --git a/sys-libs/glibc/glibc-2.34-r14.ebuild b/sys-libs/glibc/glibc-2.34-r14.ebuild
index 544d8be04150..0a2e4d90ccb4 100644
--- a/sys-libs/glibc/glibc-2.34-r14.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r14.ebuild
@@ -399,13 +399,13 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
-		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2
 	fi
 
 	strip-unsupported-flags
+	filter-lto
 	filter-flags -m32 -m64 '-mabi=*'
 
 	# glibc aborts if rpath is set by LDFLAGS

diff --git a/sys-libs/glibc/glibc-2.35-r11.ebuild b/sys-libs/glibc/glibc-2.35-r11.ebuild
index 5b6649f3f6de..090f19b517a8 100644
--- a/sys-libs/glibc/glibc-2.35-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r11.ebuild
@@ -412,13 +412,13 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
-		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2
 	fi
 
 	strip-unsupported-flags
+	filter-lto
 	filter-flags -m32 -m64 '-mabi=*'
 
 	# glibc aborts if rpath is set by LDFLAGS

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
index 49ab641a06f2..c1813a55f183 100644
--- a/sys-libs/glibc/glibc-2.36-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r7.ebuild
@@ -418,13 +418,13 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
-		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2
 	fi
 
 	strip-unsupported-flags
+	filter-lto
 	filter-flags -m32 -m64 '-mabi=*'
 
 	# glibc aborts if rpath is set by LDFLAGS

diff --git a/sys-libs/glibc/glibc-2.36-r8.ebuild b/sys-libs/glibc/glibc-2.36-r8.ebuild
index dc181a1690f3..5998cc3c9055 100644
--- a/sys-libs/glibc/glibc-2.36-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r8.ebuild
@@ -418,13 +418,13 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
-		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2
 	fi
 
 	strip-unsupported-flags
+	filter-lto
 	filter-flags -m32 -m64 '-mabi=*'
 
 	# glibc aborts if rpath is set by LDFLAGS

diff --git a/sys-libs/glibc/glibc-2.37-r2.ebuild b/sys-libs/glibc/glibc-2.37-r2.ebuild
index 5c8351a2a379..b28145dab4c9 100644
--- a/sys-libs/glibc/glibc-2.37-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r2.ebuild
@@ -419,13 +419,13 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
-		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2
 	fi
 
 	strip-unsupported-flags
+	filter-lto
 	filter-flags -m32 -m64 '-mabi=*'
 
 	# glibc aborts if rpath is set by LDFLAGS

diff --git a/sys-libs/glibc/glibc-2.37-r3.ebuild b/sys-libs/glibc/glibc-2.37-r3.ebuild
index df775e7f1f85..8cb029656f12 100644
--- a/sys-libs/glibc/glibc-2.37-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r3.ebuild
@@ -407,13 +407,13 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
-		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2
 	fi
 
 	strip-unsupported-flags
+	filter-lto
 	filter-flags -m32 -m64 '-mabi=*'
 
 	# glibc aborts if rpath is set by LDFLAGS

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 54fcf643e2cf..ffcac4cc7948 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -407,13 +407,13 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
-		filter-lto
 		# Lock glibc at -O2; we want to be conservative here.
 		filter-flags '-O?'
 		append-flags -O2
 	fi
 
 	strip-unsupported-flags
+	filter-lto
 	filter-flags -m32 -m64 '-mabi=*'
 
 	# glibc aborts if rpath is set by LDFLAGS


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-06-28 21:23 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-06-28 21:23 UTC (permalink / raw
  To: gentoo-commits

commit:     3d9f5f412e1b67657366afc0b6a46c744f07a68a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 28 21:21:26 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 28 21:21:26 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d9f5f41

sys-libs/glibc: Stabilize 2.37-r3 amd64, #907241

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r3.ebuild b/sys-libs/glibc/glibc-2.37-r3.ebuild
index 8cb029656f12..a7acc180cd1e 100644
--- a/sys-libs/glibc/glibc-2.37-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r3.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-06-30 18:28 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-06-30 18:28 UTC (permalink / raw
  To: gentoo-commits

commit:     b580d9569654fa50f73942a76c0d4f8c0a5b7e31
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 30 18:28:34 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Jun 30 18:28:34 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b580d956

sys-libs/glibc: drop 2.36-r7

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.36-r7.ebuild | 1665 -----------------------------------
 2 files changed, 1666 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 404ff5d96519..bdad098b48be 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -16,7 +16,6 @@ DIST glibc-2.35-loongarch-patches-20220522.tar.xz 44728 BLAKE2B 09e7a061f3269ebd
 DIST glibc-2.35-patches-12.tar.xz 266056 BLAKE2B 7979dcfee270107d51c10e5ec74c9c1ab0d0a9743d6718a6d915d241fee6482958c957ef9fd25cd704925e3aa0d98c23115274c7594d149dec08c5e0766a488d SHA512 37a4c086b6a459cb378608a49d90705dddb806376edb2456b8c98e3a469fc558bce7b1b4c8a856b8dffb209e7b6e1c48382ed6f050284c5f74a92ca4f7d4b88a
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-2.36-patches-10.tar.xz 118268 BLAKE2B 3d1bdb6c1a9e10ba78a344ca8940f68c49411a94aefd4d66bab17d784bc8783f2ae71efb171dea6d1919ea2c4a1f54333dabc2c4d99838ba8ec568484b84d0ae SHA512 b88dfc56ffc2df495e13cf90e709629db2b9b411a1c5ba6d39f40f45be3c2f49df7b1fe320d1cd7552515fe68dfc644c12916a6db34139ccf94ff755235d3a40
-DIST glibc-2.36-patches-9.tar.xz 110440 BLAKE2B edc1aca9b7bc9ce64683e3bd905c9804b581af2d41191ae85e6f0e73d444672abe56bbb620373d31b20db8f84a2cb9ed4e1026e50ce5f287dac5c24752ee187a SHA512 1f1f85a439983b776229b924f9a8fd9aacf9efc869a212ff15b49e60627f37719b548d20b9ff1b80d88996bce115f44efdbecc6dce378a4247c6078ed7e6e1b4
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-2.37-patches-4.tar.xz 24136 BLAKE2B 4dc69ed5d5671bc6a865775b86b4227015b7636f00a92b2c4ff07006fb2a288643eb6b5f6012dd34e62f6cf2f6bd63ac1931286b64fdac39e4988b21ca4b94ae SHA512 4bb5f4c3d37f7f028b8920bbda71c32492c1ebdfe4d151cb05e9ab14040d7b16833d4d9da06c5c84a9efde7510650c90a3c188d636e02ede46f8fe5e32b9b11f
 DIST glibc-2.37-patches-5.tar.xz 37640 BLAKE2B a87fb239208eb6d65c96bf7687570d8d0919277410fe1e28c293fa7749ffa862417bc1fe6d0819e47a806b20e52d14de84b843fa879fe15b884b2742719caf87 SHA512 344276606b7330322df72ee964d3447d02907df92b5a1d20b9aa427e93727be907f915ecd62db45e994c46451bd09d5da95ef7bf1a27d247a57589c568e6cb20

diff --git a/sys-libs/glibc/glibc-2.36-r7.ebuild b/sys-libs/glibc/glibc-2.36-r7.ebuild
deleted file mode 100644
index c1813a55f183..000000000000
--- a/sys-libs/glibc/glibc-2.36-r7.ebuild
+++ /dev/null
@@ -1,1665 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..11} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=9
-PATCH_DEV=dilfridge
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-LOCALE_GEN_VER=2.23
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl 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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		app-alternatives/awk
-	)
-	test? ( dev-lang/perl )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	perl? ( dev-lang/perl )
-	test? ( dev-lang/perl )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		app-alternatives/awk
-	)
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	app-alternatives/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl no))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-07-02 14:57 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-07-02 14:57 UTC (permalink / raw
  To: gentoo-commits

commit:     da4d5e00cfe28306999f18ac432eca1a77d496ab
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jul  2 14:57:07 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jul  2 14:57:30 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=da4d5e00

sys-libs/glibc: Stabilize 2.37-r3 hppa, #907241

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r3.ebuild b/sys-libs/glibc/glibc-2.37-r3.ebuild
index a7acc180cd1e..5f1be40ebfeb 100644
--- a/sys-libs/glibc/glibc-2.37-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r3.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-07-04 11:18 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-07-04 11:18 UTC (permalink / raw
  To: gentoo-commits

commit:     018d5f301fe4bf859e66bf5f1f7b9db94d8104c2
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  4 11:17:56 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jul  4 11:18:17 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=018d5f30

sys-libs/glibc: relax python dependencies

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r3.ebuild | 16 ++++++----------
 sys-libs/glibc/glibc-9999.ebuild    | 18 +++++++-----------
 2 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.37-r3.ebuild b/sys-libs/glibc/glibc-2.37-r3.ebuild
index 5f1be40ebfeb..f5259765d7d6 100644
--- a/sys-libs/glibc/glibc-2.37-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r3.ebuild
@@ -6,10 +6,13 @@ EAPI=8
 # Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
 # Please read & adapt the page as necessary if obsolete.
 
-PYTHON_COMPAT=( python3_{9..11} )
+# Please keep the python line in BDEPEND updated and do NOT use eclasses pr
+# ${PYTHON_DEPS} (since they are too strict and lead to problems with the
+# package order during upgrades).
+
 TMPFILES_OPTIONAL=1
 
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+inherit prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing tmpfiles
 
 DESCRIPTION="GNU libc C library"
@@ -101,7 +104,7 @@ IDEPEND="
 	!compile-locales? ( sys-apps/locale-gen )
 "
 BDEPEND="
-	${PYTHON_DEPS}
+	|| ( dev-lang/python:3.11 dev-lang/python:3.10 dev-lang/python:3.9 )
 	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
 	sys-devel/bison
 	compile-locales? ( sys-apps/locale-gen )
@@ -863,13 +866,6 @@ pkg_pretend() {
 	upgrade_warning
 }
 
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
 # src_unpack
 
 src_unpack() {

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ffcac4cc7948..53192e4ee2dc 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -6,10 +6,13 @@ EAPI=8
 # Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
 # Please read & adapt the page as necessary if obsolete.
 
-PYTHON_COMPAT=( python3_{9..11} )
+# Please keep the python line in BDEPEND updated and do NOT use eclasses pr
+# ${PYTHON_DEPS} (since they are too strict and lead to problems with the
+# package order during upgrades).
+
 TMPFILES_OPTIONAL=1
 
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+inherit prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
 	multilib systemd multiprocessing tmpfiles
 
 DESCRIPTION="GNU libc C library"
@@ -39,7 +42,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	#KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi
@@ -101,7 +104,7 @@ IDEPEND="
 	!compile-locales? ( sys-apps/locale-gen )
 "
 BDEPEND="
-	${PYTHON_DEPS}
+	|| ( dev-lang/python:3.11 dev-lang/python:3.10 dev-lang/python:3.9 )
 	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
 	sys-devel/bison
 	compile-locales? ( sys-apps/locale-gen )
@@ -863,13 +866,6 @@ pkg_pretend() {
 	upgrade_warning
 }
 
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
 # src_unpack
 
 src_unpack() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-07-09 19:07 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2023-07-09 19:07 UTC (permalink / raw
  To: gentoo-commits

commit:     ee8a5f0c414b11ab95dad668ce0a50a0397b9642
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Jul  9 19:05:13 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Jul  9 19:05:13 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee8a5f0c

sys-libs/glibc: Stabilize 2.37-r3 x86, #907241

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r3.ebuild b/sys-libs/glibc/glibc-2.37-r3.ebuild
index f5259765d7d6..ff1e2795f530 100644
--- a/sys-libs/glibc/glibc-2.37-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r3.ebuild
@@ -42,7 +42,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-07-09 19:07 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2023-07-09 19:07 UTC (permalink / raw
  To: gentoo-commits

commit:     97bfedb2829409f25399c6faa72ec6cd8984e4d3
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Jul  9 19:05:32 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Jul  9 19:05:32 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=97bfedb2

sys-libs/glibc: Stabilize 2.37-r3 arm, #907241

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r3.ebuild b/sys-libs/glibc/glibc-2.37-r3.ebuild
index ff1e2795f530..6eb7455aedb6 100644
--- a/sys-libs/glibc/glibc-2.37-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r3.ebuild
@@ -42,7 +42,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-07-09 19:07 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2023-07-09 19:07 UTC (permalink / raw
  To: gentoo-commits

commit:     643754e53fd9b21a4d39e9f7dee89bd71a9341fa
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Jul  9 19:06:13 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Jul  9 19:06:13 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=643754e5

sys-libs/glibc: Stabilize 2.37-r3 arm64, #907241

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r3.ebuild b/sys-libs/glibc/glibc-2.37-r3.ebuild
index 6eb7455aedb6..e92a8205be02 100644
--- a/sys-libs/glibc/glibc-2.37-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r3.ebuild
@@ -42,7 +42,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-07-13 10:08 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-07-13 10:08 UTC (permalink / raw
  To: gentoo-commits

commit:     45c4917a9a1df312afa0e34c00930c248c3fa0fa
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 13 10:07:29 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jul 13 10:07:29 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=45c4917a

sys-libs/glibc: add link to glibc FAQ for -O0

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r3.ebuild | 1 +
 sys-libs/glibc/glibc-9999.ebuild    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.37-r3.ebuild b/sys-libs/glibc/glibc-2.37-r3.ebuild
index e92a8205be02..a47bf8cd31f0 100644
--- a/sys-libs/glibc/glibc-2.37-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r3.ebuild
@@ -455,6 +455,7 @@ setup_flags() {
 
 	# glibc's headers disallow -O0 and fail at build time:
 	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
 	replace-flags -O0 -O1
 
 	# glibc handles this internally already where it's appropriate;

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 53192e4ee2dc..2b4e84c98db7 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -455,6 +455,7 @@ setup_flags() {
 
 	# glibc's headers disallow -O0 and fail at build time:
 	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
 	replace-flags -O0 -O1
 
 	# glibc handles this internally already where it's appropriate;


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-07-15 12:12 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2023-07-15 12:12 UTC (permalink / raw
  To: gentoo-commits

commit:     62b1773c4f2a69df5e43477c72f946827da8e5da
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 12:12:09 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Jul 15 12:12:09 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=62b1773c

sys-libs/glibc: Stabilize 2.37-r3 ppc64, #907241

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r3.ebuild b/sys-libs/glibc/glibc-2.37-r3.ebuild
index d3d9fe05e52d..43a4f88f66ab 100644
--- a/sys-libs/glibc/glibc-2.37-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r3.ebuild
@@ -42,7 +42,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-07-15 12:12 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2023-07-15 12:12 UTC (permalink / raw
  To: gentoo-commits

commit:     c5aea1397e76537a41d85a02f0832d85d59cfd5f
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 12:12:06 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Jul 15 12:12:06 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c5aea139

sys-libs/glibc: Stabilize 2.37-r3 ppc, #907241

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r3.ebuild b/sys-libs/glibc/glibc-2.37-r3.ebuild
index a47bf8cd31f0..d3d9fe05e52d 100644
--- a/sys-libs/glibc/glibc-2.37-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r3.ebuild
@@ -42,7 +42,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-07-15 12:12 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2023-07-15 12:12 UTC (permalink / raw
  To: gentoo-commits

commit:     fa517a80d7a24ed73bc649c8a4a4e17aa4198083
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 12:12:13 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Jul 15 12:12:13 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fa517a80

sys-libs/glibc: Stabilize 2.37-r3 sparc, #907241

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r3.ebuild b/sys-libs/glibc/glibc-2.37-r3.ebuild
index 43a4f88f66ab..f46cdcac0bfa 100644
--- a/sys-libs/glibc/glibc-2.37-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r3.ebuild
@@ -42,7 +42,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-07-17 20:28 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-07-17 20:28 UTC (permalink / raw
  To: gentoo-commits

commit:     1cc2df3cae5d01f01089e3ca102d170e02805a1c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 17 20:27:33 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jul 17 20:27:33 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1cc2df3c

sys-libs/glibc: drop 2.37-r2

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.37-r2.ebuild | 1666 -----------------------------------
 2 files changed, 1667 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index bdad098b48be..032b83d0b806 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,7 +17,6 @@ DIST glibc-2.35-patches-12.tar.xz 266056 BLAKE2B 7979dcfee270107d51c10e5ec74c9c1
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-2.36-patches-10.tar.xz 118268 BLAKE2B 3d1bdb6c1a9e10ba78a344ca8940f68c49411a94aefd4d66bab17d784bc8783f2ae71efb171dea6d1919ea2c4a1f54333dabc2c4d99838ba8ec568484b84d0ae SHA512 b88dfc56ffc2df495e13cf90e709629db2b9b411a1c5ba6d39f40f45be3c2f49df7b1fe320d1cd7552515fe68dfc644c12916a6db34139ccf94ff755235d3a40
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
-DIST glibc-2.37-patches-4.tar.xz 24136 BLAKE2B 4dc69ed5d5671bc6a865775b86b4227015b7636f00a92b2c4ff07006fb2a288643eb6b5f6012dd34e62f6cf2f6bd63ac1931286b64fdac39e4988b21ca4b94ae SHA512 4bb5f4c3d37f7f028b8920bbda71c32492c1ebdfe4d151cb05e9ab14040d7b16833d4d9da06c5c84a9efde7510650c90a3c188d636e02ede46f8fe5e32b9b11f
 DIST glibc-2.37-patches-5.tar.xz 37640 BLAKE2B a87fb239208eb6d65c96bf7687570d8d0919277410fe1e28c293fa7749ffa862417bc1fe6d0819e47a806b20e52d14de84b843fa879fe15b884b2742719caf87 SHA512 344276606b7330322df72ee964d3447d02907df92b5a1d20b9aa427e93727be907f915ecd62db45e994c46451bd09d5da95ef7bf1a27d247a57589c568e6cb20
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238

diff --git a/sys-libs/glibc/glibc-2.37-r2.ebuild b/sys-libs/glibc/glibc-2.37-r2.ebuild
deleted file mode 100644
index b28145dab4c9..000000000000
--- a/sys-libs/glibc/glibc-2.37-r2.ebuild
+++ /dev/null
@@ -1,1666 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..11} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=4
-PATCH_DEV=dilfridge
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-RELEASE_VER=${PV}
-
-GCC_BOOTSTRAP_VER=20201208
-
-LOCALE_GEN_VER=2.23
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl 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
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-# gzip, grep, awk are needed by locale-gen, bug 740750
-
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	doc? ( sys-apps/texinfo )
-	!compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		app-alternatives/awk
-	)
-	test? ( dev-lang/perl )
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	perl? ( dev-lang/perl )
-	test? ( dev-lang/perl )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-	compile-locales? (
-		app-arch/gzip
-		sys-apps/grep
-		app-alternatives/awk
-	)
-	doc? ( dev-lang/perl )
-	test? ( >=net-dns/libidn2-2.3.0 )
-"
-RDEPEND="${COMMON_DEPEND}
-	app-arch/gzip
-	sys-apps/grep
-	app-alternatives/awk
-	sys-apps/gentoo-functions
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<net-misc/openssh-8.1_p1-r2
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	# Users have had a chance to phase themselves, time to give em the boot
-	if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
-		eerror "You still haven't deleted ${EROOT}/etc/locales.build."
-		eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
-		die "Lazy upgrader detected"
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.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() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${RELEASE_VER}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}"
-	find . -name configure -exec touch {} +
-
-	# move the external locale-gen to its old place
-	mkdir extra || die
-	mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
-
-	eprefixify extra/locale/locale-gen
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}"
-}
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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() {
-	local ret=0
-
-	glibc_src_test
-	: $(( ret |= $? ))
-
-	return ${ret}
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	# Give tests more time to complete.
-	export TIMEOUTFACTOR=5
-
-	foreach_abi do_src_test || die "tests failed"
-}
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-	# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-	cd "${WORKDIR}"/extra/locale
-	dosbin locale-gen
-	doman *.[0-8]
-	insinto /etc
-	doins locale.gen
-
-	keepdir /usr/lib/locale
-
-	cd "${S}"
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-		sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-07-24 22:19 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-07-24 22:19 UTC (permalink / raw
  To: gentoo-commits

commit:     97b9ba43cdb2a8da636cbc71dde9a5d6239b26a2
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 24 22:17:40 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jul 24 22:19:15 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=97b9ba43

sys-libs/glibc: Add --enable-fortify-source configure parameter (new)

Without this, _FORTIFY_SOURCE now gets undefined.
With it (but without an explicit value), glibc picks the maximum supported
number (on current toolchain 3).

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2b4e84c98db7..2d5a5b523933 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -986,6 +986,7 @@ glibc_do_configure() {
 	myconf+=(
 		--disable-werror
 		--enable-bind-now
+		--enable-fortify-source
 		--build=${CBUILD_OPT:-${CBUILD}}
 		--host=${CTARGET_OPT:-${CTARGET}}
 		$(use_enable profile)


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-07-24 22:32 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-07-24 22:32 UTC (permalink / raw
  To: gentoo-commits

commit:     ed887cafe7e652cfcf4525fbbd86b1d7930d180e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 24 22:31:12 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jul 24 22:31:12 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ed887caf

sys-libs/glibc: Boldly assume our aarch64 toolchain can build SVE instructions

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2d5a5b523933..79c3065fcb4e 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1028,6 +1028,11 @@ glibc_do_configure() {
 		libc_cv_have_x86_lahf_sahf=no
 		libc_cv_have_x86_movbe=no
 
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
 		${EXTRA_ECONF}
 	)
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-07-24 22:44 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-07-24 22:44 UTC (permalink / raw
  To: gentoo-commits

commit:     1f0fd3e2aee01e0c09e7103c8af4183b57faef49
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 24 22:42:52 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jul 24 22:43:14 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1f0fd3e2

sys-libs/glibc: drop stale workarounds

As of >=2.35, all of these are fixed.

Bug: https://bugs.gentoo.org/785091
Bug: https://sourceware.org/PR27318
Bug: https://sourceware.org/PR27991
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 79c3065fcb4e..11f5063768f5 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1018,16 +1018,6 @@ glibc_do_configure() {
 		# https://bugs.gentoo.org/753740
 		libc_cv_complocaledir='${exec_prefix}/lib/locale'
 
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
 		# On aarch64 there is no way to override -mcpu=native, and if
 		# the current cpu does not support SVE configure fails.
 		# Let's boldly assume our toolchain can always build SVE instructions.


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-07-24 22:45 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-07-24 22:45 UTC (permalink / raw
  To: gentoo-commits

commit:     8b9d01719e16b0016f6525a99e8087e8ee1b50eb
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 24 22:45:04 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jul 24 22:45:04 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8b9d0171

Revert "sys-libs/glibc: relax python dependencies"

This reverts commit 018d5f301fe4bf859e66bf5f1f7b9db94d8104c2.

Now that bug #910288 is fixed, we don't need to do this anymore.

Bug: https://bugs.gentoo.org/910288
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r3.ebuild | 16 ++++++++++------
 sys-libs/glibc/glibc-9999.ebuild    | 18 +++++++++++-------
 2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.37-r3.ebuild b/sys-libs/glibc/glibc-2.37-r3.ebuild
index f46cdcac0bfa..c3c9ca521d37 100644
--- a/sys-libs/glibc/glibc-2.37-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r3.ebuild
@@ -6,13 +6,10 @@ EAPI=8
 # Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
 # Please read & adapt the page as necessary if obsolete.
 
-# Please keep the python line in BDEPEND updated and do NOT use eclasses pr
-# ${PYTHON_DEPS} (since they are too strict and lead to problems with the
-# package order during upgrades).
-
+PYTHON_COMPAT=( python3_{9..11} )
 TMPFILES_OPTIONAL=1
 
-inherit prefix preserve-libs 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"
@@ -104,7 +101,7 @@ IDEPEND="
 	!compile-locales? ( sys-apps/locale-gen )
 "
 BDEPEND="
-	|| ( dev-lang/python:3.11 dev-lang/python:3.10 dev-lang/python:3.9 )
+	${PYTHON_DEPS}
 	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
 	sys-devel/bison
 	compile-locales? ( sys-apps/locale-gen )
@@ -867,6 +864,13 @@ pkg_pretend() {
 	upgrade_warning
 }
 
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
 # src_unpack
 
 src_unpack() {

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 11f5063768f5..a0250a2928fc 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -6,13 +6,10 @@ EAPI=8
 # Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
 # Please read & adapt the page as necessary if obsolete.
 
-# Please keep the python line in BDEPEND updated and do NOT use eclasses pr
-# ${PYTHON_DEPS} (since they are too strict and lead to problems with the
-# package order during upgrades).
-
+PYTHON_COMPAT=( python3_{9..11} )
 TMPFILES_OPTIONAL=1
 
-inherit prefix preserve-libs 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"
@@ -42,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi
@@ -104,7 +101,7 @@ IDEPEND="
 	!compile-locales? ( sys-apps/locale-gen )
 "
 BDEPEND="
-	|| ( dev-lang/python:3.11 dev-lang/python:3.10 dev-lang/python:3.9 )
+	${PYTHON_DEPS}
 	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
 	sys-devel/bison
 	compile-locales? ( sys-apps/locale-gen )
@@ -867,6 +864,13 @@ pkg_pretend() {
 	upgrade_warning
 }
 
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
 # src_unpack
 
 src_unpack() {


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-07-29 12:22 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-07-29 12:22 UTC (permalink / raw
  To: gentoo-commits

commit:     ec7630170f1f7c47826d6c0738f705ca516cf237
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 29 12:21:32 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jul 29 12:22:15 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec763017

sys-libs/glibc: 2.37 patchset 6 bump (2.37-r4)

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.37-r4.ebuild | 1648 +++++++++++++++++++++++++++++++++++
 2 files changed, 1649 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 032b83d0b806..350941f5edc1 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,6 +18,7 @@ DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c5240
 DIST glibc-2.36-patches-10.tar.xz 118268 BLAKE2B 3d1bdb6c1a9e10ba78a344ca8940f68c49411a94aefd4d66bab17d784bc8783f2ae71efb171dea6d1919ea2c4a1f54333dabc2c4d99838ba8ec568484b84d0ae SHA512 b88dfc56ffc2df495e13cf90e709629db2b9b411a1c5ba6d39f40f45be3c2f49df7b1fe320d1cd7552515fe68dfc644c12916a6db34139ccf94ff755235d3a40
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-2.37-patches-5.tar.xz 37640 BLAKE2B a87fb239208eb6d65c96bf7687570d8d0919277410fe1e28c293fa7749ffa862417bc1fe6d0819e47a806b20e52d14de84b843fa879fe15b884b2742719caf87 SHA512 344276606b7330322df72ee964d3447d02907df92b5a1d20b9aa427e93727be907f915ecd62db45e994c46451bd09d5da95ef7bf1a27d247a57589c568e6cb20
+DIST glibc-2.37-patches-6.tar.xz 47132 BLAKE2B a20c2390ef6342ac03abdf131f19221792cb9c7a050cdd5f87c9cfd2b6456edf60e7bfa14a487f11e95698cca736c55872bd4d1e27a915b93ee46f51f9771e8c SHA512 72b4363183c562708043fe6728bc475a4a92273e4707432d4d18c7c737bbc7707be5162923b7ee6e36cdd3eca1d8d4b68542d7162d399f0d60fb8dd6e35f1167
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.37-r4.ebuild b/sys-libs/glibc/glibc-2.37-r4.ebuild
new file mode 100644
index 000000000000..f56ce57ab082
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.37-r4.ebuild
@@ -0,0 +1,1648 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..11} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=6
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-07-29 23:43 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-07-29 23:43 UTC (permalink / raw
  To: gentoo-commits

commit:     7eb2a5dbb6589c46a54739968c5f6b1ef5b00fa2
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 29 23:43:24 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jul 29 23:43:48 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7eb2a5db

sys-libs/glibc: keyword 2.37-r4

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r4.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r4.ebuild b/sys-libs/glibc/glibc-2.37-r4.ebuild
index f56ce57ab082..830de3656427 100644
--- a/sys-libs/glibc/glibc-2.37-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r4.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-07-31 21:42 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-07-31 21:42 UTC (permalink / raw
  To: gentoo-commits

commit:     1920e3bac2933a3ad6cfad92716ed803ae72ee6e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 31 21:42:10 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jul 31 21:42:10 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1920e3ba

sys-libs/glibc: add 2.38

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          |    2 +
 sys-libs/glibc/glibc-2.38.ebuild | 1644 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 1646 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 350941f5edc1..77026f28f181 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,6 +20,8 @@ DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a59
 DIST glibc-2.37-patches-5.tar.xz 37640 BLAKE2B a87fb239208eb6d65c96bf7687570d8d0919277410fe1e28c293fa7749ffa862417bc1fe6d0819e47a806b20e52d14de84b843fa879fe15b884b2742719caf87 SHA512 344276606b7330322df72ee964d3447d02907df92b5a1d20b9aa427e93727be907f915ecd62db45e994c46451bd09d5da95ef7bf1a27d247a57589c568e6cb20
 DIST glibc-2.37-patches-6.tar.xz 47132 BLAKE2B a20c2390ef6342ac03abdf131f19221792cb9c7a050cdd5f87c9cfd2b6456edf60e7bfa14a487f11e95698cca736c55872bd4d1e27a915b93ee46f51f9771e8c SHA512 72b4363183c562708043fe6728bc475a4a92273e4707432d4d18c7c737bbc7707be5162923b7ee6e36cdd3eca1d8d4b68542d7162d399f0d60fb8dd6e35f1167
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
+DIST glibc-2.38-patches-1.tar.xz 13688 BLAKE2B 198bbaff878c6ede8501b84d996e219af0b2ed82280f98f7858db65feb814c15468808e92bb5e0cc19b38cebc50ec019c3309cfb09193f6cd51d2f1c6a312a3b SHA512 dd760bb73e9b7b90ffabab9bbbb6ef9b2a329ceaa7f75e4a28391b28291160e53b1bac78497ef59c98cd8a4522f59de6fc40681361e1ebfd62f85f0c85d7c262
+DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff

diff --git a/sys-libs/glibc/glibc-2.38.ebuild b/sys-libs/glibc/glibc-2.38.ebuild
new file mode 100644
index 000000000000..a0250a2928fc
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.38.ebuild
@@ -0,0 +1,1644 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..11} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=1
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-08-02 21:55 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-08-02 21:55 UTC (permalink / raw
  To: gentoo-commits

commit:     20f797f1093cf4d531e059d0b6bd6bc962550ed0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Aug  2 21:51:24 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Aug  2 21:54:13 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=20f797f1

sys-libs/glibc: skip extra tests in systemd-nspawn containers

Some tests fail because of systemd-nspawn's default restrictive seccomp filter
list. Skip those tests only when systemd-detect-virt reckons we're in an nspawn
container.

Bug: https://sourceware.org/PR30603
Closes: https://github.com/gentoo/gentoo/pull/32148
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r4.ebuild | 25 +++++++++++++++++++++++++
 sys-libs/glibc/glibc-2.38.ebuild    | 25 +++++++++++++++++++++++++
 sys-libs/glibc/glibc-9999.ebuild    | 25 +++++++++++++++++++++++++
 3 files changed, 75 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.37-r4.ebuild b/sys-libs/glibc/glibc-2.37-r4.ebuild
index 830de3656427..5fb0eb873238 100644
--- a/sys-libs/glibc/glibc-2.37-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r4.ebuild
@@ -170,6 +170,25 @@ XFAIL_TEST_LIST=(
 	tst-strsignal
 )
 
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+)
+
 #
 # Small helper functions
 #
@@ -1225,6 +1244,12 @@ glibc_src_test() {
 
 	local myxfailparams=""
 	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
 		for myt in ${XFAIL_TEST_LIST[@]} ; do
 			myxfailparams+="test-xfail-${myt}=yes "
 		done

diff --git a/sys-libs/glibc/glibc-2.38.ebuild b/sys-libs/glibc/glibc-2.38.ebuild
index a0250a2928fc..1e4988e77976 100644
--- a/sys-libs/glibc/glibc-2.38.ebuild
+++ b/sys-libs/glibc/glibc-2.38.ebuild
@@ -170,6 +170,25 @@ XFAIL_TEST_LIST=(
 	tst-strsignal
 )
 
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+)
+
 #
 # Small helper functions
 #
@@ -1221,6 +1240,12 @@ glibc_src_test() {
 
 	local myxfailparams=""
 	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
 		for myt in ${XFAIL_TEST_LIST[@]} ; do
 			myxfailparams+="test-xfail-${myt}=yes "
 		done

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a0250a2928fc..1e4988e77976 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -170,6 +170,25 @@ XFAIL_TEST_LIST=(
 	tst-strsignal
 )
 
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+)
+
 #
 # Small helper functions
 #
@@ -1221,6 +1240,12 @@ glibc_src_test() {
 
 	local myxfailparams=""
 	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
 		for myt in ${XFAIL_TEST_LIST[@]} ; do
 			myxfailparams+="test-xfail-${myt}=yes "
 		done


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-08-02 22:58 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-08-02 22:58 UTC (permalink / raw
  To: gentoo-commits

commit:     e1c4193fd354aab01c8e53282b7cb36a0c2bfcd5
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Aug  2 22:57:14 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Aug  2 22:57:54 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e1c4193f

sys-libs/glibc: skip a handful more nspawn-sensitive tests

These seem to fail in nspawn with --suppress-sync, --ephemeral, and/or some other
low priority setting.

We're only skipping these for nspawn, so it's not a big deal.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r4.ebuild | 5 +++++
 sys-libs/glibc/glibc-2.38.ebuild    | 5 +++++
 sys-libs/glibc/glibc-9999.ebuild    | 5 +++++
 3 files changed, 15 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.37-r4.ebuild b/sys-libs/glibc/glibc-2.37-r4.ebuild
index 5fb0eb873238..6a907b7f56e4 100644
--- a/sys-libs/glibc/glibc-2.37-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r4.ebuild
@@ -187,6 +187,11 @@ XFAIL_NSPAWN_TEST_LIST=(
 	tst-adjtime-time64
 	tst-clock2
 	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	tst-sched1
+	test-errno
 )
 
 #

diff --git a/sys-libs/glibc/glibc-2.38.ebuild b/sys-libs/glibc/glibc-2.38.ebuild
index 1e4988e77976..4e348b241285 100644
--- a/sys-libs/glibc/glibc-2.38.ebuild
+++ b/sys-libs/glibc/glibc-2.38.ebuild
@@ -187,6 +187,11 @@ XFAIL_NSPAWN_TEST_LIST=(
 	tst-adjtime-time64
 	tst-clock2
 	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	tst-sched1
+	test-errno
 )
 
 #

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 1e4988e77976..4e348b241285 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -187,6 +187,11 @@ XFAIL_NSPAWN_TEST_LIST=(
 	tst-adjtime-time64
 	tst-clock2
 	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	tst-sched1
+	test-errno
 )
 
 #


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-08-17  4:48 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-08-17  4:48 UTC (permalink / raw
  To: gentoo-commits

commit:     b9e35b8a6e84d080bfd4f786d6603b0f96a478b3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 17 04:44:17 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Aug 17 04:48:33 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b9e35b8a

sys-libs/glibc: rephrase cross comment

Bit clearer now.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38.ebuild | 4 ++--
 sys-libs/glibc/glibc-9999.ebuild | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.38.ebuild b/sys-libs/glibc/glibc-2.38.ebuild
index 4e348b241285..bdd4d0566e37 100644
--- a/sys-libs/glibc/glibc-2.38.ebuild
+++ b/sys-libs/glibc/glibc-2.38.ebuild
@@ -653,8 +653,8 @@ setup_env() {
 	export CXX="${glibc__GLIBC_CXX} ${glibc__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
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 4e348b241285..bdd4d0566e37 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -653,8 +653,8 @@ setup_env() {
 	export CXX="${glibc__GLIBC_CXX} ${glibc__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
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-08-17  4:48 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-08-17  4:48 UTC (permalink / raw
  To: gentoo-commits

commit:     d99a6d12ded13549fd16b2dce7cda093b437c07a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 17 04:47:51 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Aug 17 04:48:33 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d99a6d12

sys-libs/glibc: fix test program for multilib-bootstrap

Fix -Wstrict-prototypes, -Wimplicit-int.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.38.ebuild b/sys-libs/glibc/glibc-2.38.ebuild
index bdd4d0566e37..c80a8e763200 100644
--- a/sys-libs/glibc/glibc-2.38.ebuild
+++ b/sys-libs/glibc/glibc-2.38.ebuild
@@ -1089,7 +1089,7 @@ glibc_do_configure() {
 	# add x32 to it, gcc/glibc don't yet support x32.
 	#
 	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
+		echo 'int main(void){}' > "${T}"/test.c || die
 		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
 			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
 		fi

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index bdd4d0566e37..c80a8e763200 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1089,7 +1089,7 @@ glibc_do_configure() {
 	# add x32 to it, gcc/glibc don't yet support x32.
 	#
 	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
+		echo 'int main(void){}' > "${T}"/test.c || die
 		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
 			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
 		fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-08-23 12:30 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-08-23 12:30 UTC (permalink / raw
  To: gentoo-commits

commit:     f1a1e6c37fd7bd83b19d4855f752755f6a38c14c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 23 12:29:01 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Aug 23 12:30:02 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f1a1e6c3

sys-libs/glibc: 2.38 patchlevel 2 bump

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.38-r1.ebuild | 1674 +++++++++++++++++++++++++++++++++++
 2 files changed, 1675 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 77026f28f181..386deabdd712 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -21,6 +21,7 @@ DIST glibc-2.37-patches-5.tar.xz 37640 BLAKE2B a87fb239208eb6d65c96bf7687570d8d0
 DIST glibc-2.37-patches-6.tar.xz 47132 BLAKE2B a20c2390ef6342ac03abdf131f19221792cb9c7a050cdd5f87c9cfd2b6456edf60e7bfa14a487f11e95698cca736c55872bd4d1e27a915b93ee46f51f9771e8c SHA512 72b4363183c562708043fe6728bc475a4a92273e4707432d4d18c7c737bbc7707be5162923b7ee6e36cdd3eca1d8d4b68542d7162d399f0d60fb8dd6e35f1167
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-1.tar.xz 13688 BLAKE2B 198bbaff878c6ede8501b84d996e219af0b2ed82280f98f7858db65feb814c15468808e92bb5e0cc19b38cebc50ec019c3309cfb09193f6cd51d2f1c6a312a3b SHA512 dd760bb73e9b7b90ffabab9bbbb6ef9b2a329ceaa7f75e4a28391b28291160e53b1bac78497ef59c98cd8a4522f59de6fc40681361e1ebfd62f85f0c85d7c262
+DIST glibc-2.38-patches-2.tar.xz 25512 BLAKE2B d7827f25017e7a2391442db42f21b7f365faa9da508cba19ae597ae69b7b20c93e8fe4b4a9a64af21153afe88e8ae2d358aca5819a42d8c42b2c82cdebbcaa33 SHA512 de5843108a2ba411c58ea7c2d3c1aa8eed91589ed286ae89e954fdc1dd14c36825864283764131795e5005290e2ba627a85f2c775d8aedbd920f669be66077ad
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.38-r1.ebuild b/sys-libs/glibc/glibc-2.38-r1.ebuild
new file mode 100644
index 000000000000..e3fa46f4a7ca
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.38-r1.ebuild
@@ -0,0 +1,1674 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..12} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=2
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	tst-sched1
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-08-23 22:46 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-08-23 22:46 UTC (permalink / raw
  To: gentoo-commits

commit:     91d8fb0f15117931a1dc1943e93a792e77f49499
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 23 22:45:45 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Aug 23 22:45:45 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=91d8fb0f

sys-libs/glibc: drop 2.38

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          |    1 -
 sys-libs/glibc/glibc-2.38.ebuild | 1674 --------------------------------------
 2 files changed, 1675 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 386deabdd712..98c77313a114 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,7 +20,6 @@ DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a59
 DIST glibc-2.37-patches-5.tar.xz 37640 BLAKE2B a87fb239208eb6d65c96bf7687570d8d0919277410fe1e28c293fa7749ffa862417bc1fe6d0819e47a806b20e52d14de84b843fa879fe15b884b2742719caf87 SHA512 344276606b7330322df72ee964d3447d02907df92b5a1d20b9aa427e93727be907f915ecd62db45e994c46451bd09d5da95ef7bf1a27d247a57589c568e6cb20
 DIST glibc-2.37-patches-6.tar.xz 47132 BLAKE2B a20c2390ef6342ac03abdf131f19221792cb9c7a050cdd5f87c9cfd2b6456edf60e7bfa14a487f11e95698cca736c55872bd4d1e27a915b93ee46f51f9771e8c SHA512 72b4363183c562708043fe6728bc475a4a92273e4707432d4d18c7c737bbc7707be5162923b7ee6e36cdd3eca1d8d4b68542d7162d399f0d60fb8dd6e35f1167
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
-DIST glibc-2.38-patches-1.tar.xz 13688 BLAKE2B 198bbaff878c6ede8501b84d996e219af0b2ed82280f98f7858db65feb814c15468808e92bb5e0cc19b38cebc50ec019c3309cfb09193f6cd51d2f1c6a312a3b SHA512 dd760bb73e9b7b90ffabab9bbbb6ef9b2a329ceaa7f75e4a28391b28291160e53b1bac78497ef59c98cd8a4522f59de6fc40681361e1ebfd62f85f0c85d7c262
 DIST glibc-2.38-patches-2.tar.xz 25512 BLAKE2B d7827f25017e7a2391442db42f21b7f365faa9da508cba19ae597ae69b7b20c93e8fe4b4a9a64af21153afe88e8ae2d358aca5819a42d8c42b2c82cdebbcaa33 SHA512 de5843108a2ba411c58ea7c2d3c1aa8eed91589ed286ae89e954fdc1dd14c36825864283764131795e5005290e2ba627a85f2c775d8aedbd920f669be66077ad
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238

diff --git a/sys-libs/glibc/glibc-2.38.ebuild b/sys-libs/glibc/glibc-2.38.ebuild
deleted file mode 100644
index c80a8e763200..000000000000
--- a/sys-libs/glibc/glibc-2.38.ebuild
+++ /dev/null
@@ -1,1674 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..11} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=1
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	tst-sched1
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-08-24 11:23 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-08-24 11:23 UTC (permalink / raw
  To: gentoo-commits

commit:     caf7bf40a7ea17b23695f35249573cb9bf621b79
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 24 11:22:54 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Aug 24 11:22:54 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=caf7bf40

sys-libs/glibc: keyword 2.38-r1

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r1.ebuild b/sys-libs/glibc/glibc-2.38-r1.ebuild
index e3fa46f4a7ca..ee566898a630 100644
--- a/sys-libs/glibc/glibc-2.38-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r1.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-08-24 14:57 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-08-24 14:57 UTC (permalink / raw
  To: gentoo-commits

commit:     e0bfeb250d886e096fd861a5d280e798c1e16e9c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 24 14:57:30 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Aug 24 14:57:32 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e0bfeb25

sys-libs/glibc: don't show upgrade_warning for cross-*

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r4.ebuild | 2 ++
 sys-libs/glibc/glibc-2.38-r1.ebuild | 2 ++
 sys-libs/glibc/glibc-9999.ebuild    | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.37-r4.ebuild b/sys-libs/glibc/glibc-2.37-r4.ebuild
index 6a907b7f56e4..28494cebf365 100644
--- a/sys-libs/glibc/glibc-2.37-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r4.ebuild
@@ -864,6 +864,8 @@ sanity_prechecks() {
 }
 
 upgrade_warning() {
+	is_crosscompile && return
+
 	if [[ ${MERGE_TYPE} != buildonly && -n ${REPLACING_VERSIONS} && -z ${ROOT} ]]; then
 		local oldv newv=$(ver_cut 1-2 ${PV})
 		for oldv in ${REPLACING_VERSIONS}; do

diff --git a/sys-libs/glibc/glibc-2.38-r1.ebuild b/sys-libs/glibc/glibc-2.38-r1.ebuild
index ee566898a630..1182ef8ae5ac 100644
--- a/sys-libs/glibc/glibc-2.38-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r1.ebuild
@@ -864,6 +864,8 @@ sanity_prechecks() {
 }
 
 upgrade_warning() {
+	is_crosscompile && return
+
 	if [[ ${MERGE_TYPE} != buildonly && -n ${REPLACING_VERSIONS} && -z ${ROOT} ]]; then
 		local oldv newv=$(ver_cut 1-2 ${PV})
 		for oldv in ${REPLACING_VERSIONS}; do

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index c80a8e763200..6863e2427bf6 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -864,6 +864,8 @@ sanity_prechecks() {
 }
 
 upgrade_warning() {
+	is_crosscompile && return
+
 	if [[ ${MERGE_TYPE} != buildonly && -n ${REPLACING_VERSIONS} && -z ${ROOT} ]]; then
 		local oldv newv=$(ver_cut 1-2 ${PV})
 		for oldv in ${REPLACING_VERSIONS}; do


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-09-13 15:03 James Le Cuirot
  0 siblings, 0 replies; 1076+ messages in thread
From: James Le Cuirot @ 2023-09-13 15:03 UTC (permalink / raw
  To: gentoo-commits

commit:     59d1f02bcce879c6e565ba605afc4eddd1dce871
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 13 08:01:00 2023 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Wed Sep 13 15:03:14 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59d1f02b

sys-libs/glibc: Filter -Wl,--dynamic-linker=* from LDFLAGS

This flag is added for cross-prefix by cross-boss, but causes ldconfig to
segfault. It's not needed here anyway because glibc already handles this by
itself.

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r1.ebuild | 4 ++++
 sys-libs/glibc/glibc-9999.ebuild    | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.38-r1.ebuild b/sys-libs/glibc/glibc-2.38-r1.ebuild
index 1182ef8ae5ac..6ad50eea426b 100644
--- a/sys-libs/glibc/glibc-2.38-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r1.ebuild
@@ -447,6 +447,10 @@ setup_flags() {
 	# https://sourceware.org/PR27837
 	filter-ldflags '-Wl,--relax'
 
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
 	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
 	# we have to do that here already so mips can filter it out again :P
 	if use hash-sysv-compat ; then

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 6863e2427bf6..4e85a4b43e39 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -447,6 +447,10 @@ setup_flags() {
 	# https://sourceware.org/PR27837
 	filter-ldflags '-Wl,--relax'
 
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
 	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
 	# we have to do that here already so mips can filter it out again :P
 	if use hash-sysv-compat ; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-09-16  9:40 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-09-16  9:40 UTC (permalink / raw
  To: gentoo-commits

commit:     5e4787264d2ac33ff1718753e683122950fcf317
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 16 09:39:52 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Sep 16 09:40:33 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5e478726

sys-libs/glibc: 2.37 and 2.38 patchset bumps, untested

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 +
 sys-libs/glibc/glibc-2.37-r5.ebuild | 1680 +++++++++++++++++++++++++++++++++++
 sys-libs/glibc/glibc-2.38-r2.ebuild | 1680 +++++++++++++++++++++++++++++++++++
 3 files changed, 3362 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 98c77313a114..417cfa90167d 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,8 +19,10 @@ DIST glibc-2.36-patches-10.tar.xz 118268 BLAKE2B 3d1bdb6c1a9e10ba78a344ca8940f68
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-2.37-patches-5.tar.xz 37640 BLAKE2B a87fb239208eb6d65c96bf7687570d8d0919277410fe1e28c293fa7749ffa862417bc1fe6d0819e47a806b20e52d14de84b843fa879fe15b884b2742719caf87 SHA512 344276606b7330322df72ee964d3447d02907df92b5a1d20b9aa427e93727be907f915ecd62db45e994c46451bd09d5da95ef7bf1a27d247a57589c568e6cb20
 DIST glibc-2.37-patches-6.tar.xz 47132 BLAKE2B a20c2390ef6342ac03abdf131f19221792cb9c7a050cdd5f87c9cfd2b6456edf60e7bfa14a487f11e95698cca736c55872bd4d1e27a915b93ee46f51f9771e8c SHA512 72b4363183c562708043fe6728bc475a4a92273e4707432d4d18c7c737bbc7707be5162923b7ee6e36cdd3eca1d8d4b68542d7162d399f0d60fb8dd6e35f1167
+DIST glibc-2.37-patches-7.tar.xz 67408 BLAKE2B 0ac88c420020f32a2447a6cd8e931c95cf9438003b504ee69c5f4af551e060dd49919367d1554d99ed7dad331116e57dde8ce94975f1d1920141c13a16666236 SHA512 0de4ac41eff88f23a1b2d824219356443d79ecf1a08139028bba40a12b730df0f7df84d660b366ecd0a1801f708eff070bc121ab04cdad87a9498802b1c174c0
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-2.tar.xz 25512 BLAKE2B d7827f25017e7a2391442db42f21b7f365faa9da508cba19ae597ae69b7b20c93e8fe4b4a9a64af21153afe88e8ae2d358aca5819a42d8c42b2c82cdebbcaa33 SHA512 de5843108a2ba411c58ea7c2d3c1aa8eed91589ed286ae89e954fdc1dd14c36825864283764131795e5005290e2ba627a85f2c775d8aedbd920f669be66077ad
+DIST glibc-2.38-patches-3.tar.xz 44784 BLAKE2B 59d94b83d95fb9eea177409180e90352c0eeca65959951377ec80f0d29c43d71f7000d1e7302fc1f4ecd2d742582fc1f4d4afb2db056c959fca3da8b7c79dfae SHA512 14c19d1970678ecc5eabb86de3a46c1866acbfec96e7aaa334b3cb5b10446ae9d2f3337943473a35fe8bef9c382a0bdc341fc95ff01ff668a178e9c05cc2ded6
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.37-r5.ebuild b/sys-libs/glibc/glibc-2.37-r5.ebuild
new file mode 100644
index 000000000000..b6d3a6dbcfff
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.37-r5.ebuild
@@ -0,0 +1,1680 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..11} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=7
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	tst-sched1
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}

diff --git a/sys-libs/glibc/glibc-2.38-r2.ebuild b/sys-libs/glibc/glibc-2.38-r2.ebuild
new file mode 100644
index 000000000000..b3d2b79433e5
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.38-r2.ebuild
@@ -0,0 +1,1680 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..12} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=3
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	tst-sched1
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-09-17 11:58 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-09-17 11:58 UTC (permalink / raw
  To: gentoo-commits

commit:     03707821ecf9b634c8dfa723fad0863313e8b103
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 17 11:57:07 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Sep 17 11:57:59 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03707821

sys-libs/glibc: keyword 2.38-r2

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r2.ebuild b/sys-libs/glibc/glibc-2.38-r2.ebuild
index b3d2b79433e5..8af1710c2a35 100644
--- a/sys-libs/glibc/glibc-2.38-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r2.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-09-17 21:28 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-09-17 21:28 UTC (permalink / raw
  To: gentoo-commits

commit:     0577264e2d287b32713d3284dd5ef7830cd827ab
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 17 21:28:13 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Sep 17 21:28:30 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0577264e

sys-libs/glibc: keyword 2.37-r5

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r5.ebuild b/sys-libs/glibc/glibc-2.37-r5.ebuild
index b6d3a6dbcfff..db0c8e76b286 100644
--- a/sys-libs/glibc/glibc-2.37-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r5.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-09-18  9:55 WANG Xuerui
  0 siblings, 0 replies; 1076+ messages in thread
From: WANG Xuerui @ 2023-09-18  9:55 UTC (permalink / raw
  To: gentoo-commits

commit:     9e5d587b00d17b5d3c2fc3d76b2f9cd7803df3ee
Author:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 27 07:06:07 2023 +0000
Commit:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
CommitDate: Mon Sep 18 09:54:49 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9e5d587b

sys-libs/glibc: refresh ld.so.cache if natively installing >=2.38 on loong

The 2.38 change is ~loong-only to avoid triggering rebuilds on other
arches.

Closes: https://github.com/gentoo/gentoo/pull/32470
Reviewed-by: Sam James <sam <AT> gentoo.org>
Signed-off-by: WANG Xuerui <xen0n <AT> gentoo.org>

 .../{glibc-9999.ebuild => glibc-2.38-r3.ebuild}    | 31 ++++++++++++++++++++--
 sys-libs/glibc/glibc-9999.ebuild                   | 26 ++++++++++++++++++
 2 files changed, 55 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.38-r3.ebuild
similarity index 98%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.38-r3.ebuild
index 4e85a4b43e39..2e8876560419 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r3.ebuild
@@ -6,7 +6,7 @@ EAPI=8
 # Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
 # Please read & adapt the page as necessary if obsolete.
 
-PYTHON_COMPAT=( python3_{9..11} )
+PYTHON_COMPAT=( python3_{9..12} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
@@ -20,7 +20,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=1
+PATCH_VER=3
 PATCH_DEV=dilfridge
 
 # gcc mulitilib bootstrap files version
@@ -40,6 +40,7 @@ if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
 	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~loong"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi
@@ -1638,6 +1639,21 @@ pkg_preinst() {
 	fi
 }
 
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
 pkg_postinst() {
 	# nothing to do if just installing headers
 	just_headers && return
@@ -1648,6 +1664,17 @@ pkg_postinst() {
 	fi
 
 	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
 		use compile-locales || run_locale_gen "${EROOT}/"
 	fi
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 4e85a4b43e39..a293423678ba 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1638,6 +1638,21 @@ pkg_preinst() {
 	fi
 }
 
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
 pkg_postinst() {
 	# nothing to do if just installing headers
 	just_headers && return
@@ -1648,6 +1663,17 @@ pkg_postinst() {
 	fi
 
 	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
 		use compile-locales || run_locale_gen "${EROOT}/"
 	fi
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-09-19 18:10 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-09-19 18:10 UTC (permalink / raw
  To: gentoo-commits

commit:     406ab36652e8f9cac3f6e61990fb00c861a86a28
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 19 18:09:06 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Sep 19 18:10:12 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=406ab366

sys-libs/glibc: sync live

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a293423678ba..41218b9c69d0 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -6,7 +6,7 @@ EAPI=8
 # Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
 # Please read & adapt the page as necessary if obsolete.
 
-PYTHON_COMPAT=( python3_{9..11} )
+PYTHON_COMPAT=( python3_{10..12} )
 TMPFILES_OPTIONAL=1
 
 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-09-28  9:27 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-09-28  9:27 UTC (permalink / raw
  To: gentoo-commits

commit:     4322af1a40ea1fc4b95a6cfdeba9e048cfaad8d3
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 27 09:34:47 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Sep 28 09:27:38 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4322af1a

sys-libs/glibc: 2.38 patchlevel 4 bump

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.38-r4.ebuild | 1706 +++++++++++++++++++++++++++++++++++
 2 files changed, 1707 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 417cfa90167d..fb5cd3c8a06f 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -23,6 +23,7 @@ DIST glibc-2.37-patches-7.tar.xz 67408 BLAKE2B 0ac88c420020f32a2447a6cd8e931c95c
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-2.tar.xz 25512 BLAKE2B d7827f25017e7a2391442db42f21b7f365faa9da508cba19ae597ae69b7b20c93e8fe4b4a9a64af21153afe88e8ae2d358aca5819a42d8c42b2c82cdebbcaa33 SHA512 de5843108a2ba411c58ea7c2d3c1aa8eed91589ed286ae89e954fdc1dd14c36825864283764131795e5005290e2ba627a85f2c775d8aedbd920f669be66077ad
 DIST glibc-2.38-patches-3.tar.xz 44784 BLAKE2B 59d94b83d95fb9eea177409180e90352c0eeca65959951377ec80f0d29c43d71f7000d1e7302fc1f4ecd2d742582fc1f4d4afb2db056c959fca3da8b7c79dfae SHA512 14c19d1970678ecc5eabb86de3a46c1866acbfec96e7aaa334b3cb5b10446ae9d2f3337943473a35fe8bef9c382a0bdc341fc95ff01ff668a178e9c05cc2ded6
+DIST glibc-2.38-patches-4.tar.xz 45480 BLAKE2B d5d311e444e7a0b827cb34ea6e9685da22eb08a2e944c161ff723ad9cc73131f3afc9ee4067e79bb80d456ab9846791b6b606b013fb53cf2515807c3abb8feea SHA512 473eaef7213b0ece8fa71bb88cfa0133ce8b455b572624a0f22aa0a59a80181ac5331282e4fe1b253e037e7d7f43f8071cbefc5fba1f8a22b048fbd477d79b13
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.38-r4.ebuild b/sys-libs/glibc/glibc-2.38-r4.ebuild
new file mode 100644
index 000000000000..0224af814809
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.38-r4.ebuild
@@ -0,0 +1,1706 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..12} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=4
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	tst-sched1
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# we give the tests a bit more time to avoid spurious
+	# bug reports on slow arches
+
+	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-09-29  8:20 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-09-29  8:20 UTC (permalink / raw
  To: gentoo-commits

commit:     b364192b17056341b236626447614b62a6ce7e2b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 29 08:19:25 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep 29 08:20:00 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b364192b

sys-libs/glibc: keyword 2.38-r4

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r4.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r4.ebuild b/sys-libs/glibc/glibc-2.38-r4.ebuild
index 0224af814809..3860a4b1b2e1 100644
--- a/sys-libs/glibc/glibc-2.38-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r4.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-09-29  9:26 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-09-29  9:26 UTC (permalink / raw
  To: gentoo-commits

commit:     71d4a8d8d488db74ef6cd5e74f29f120854d1a70
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 29 09:25:44 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep 29 09:26:17 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=71d4a8d8

sys-libs/glibc: 2.37 patchlevel 8 bump

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.37-r6.ebuild | 1680 +++++++++++++++++++++++++++++++++++
 2 files changed, 1681 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index fb5cd3c8a06f..bf8c7018e43a 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,6 +20,7 @@ DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a59
 DIST glibc-2.37-patches-5.tar.xz 37640 BLAKE2B a87fb239208eb6d65c96bf7687570d8d0919277410fe1e28c293fa7749ffa862417bc1fe6d0819e47a806b20e52d14de84b843fa879fe15b884b2742719caf87 SHA512 344276606b7330322df72ee964d3447d02907df92b5a1d20b9aa427e93727be907f915ecd62db45e994c46451bd09d5da95ef7bf1a27d247a57589c568e6cb20
 DIST glibc-2.37-patches-6.tar.xz 47132 BLAKE2B a20c2390ef6342ac03abdf131f19221792cb9c7a050cdd5f87c9cfd2b6456edf60e7bfa14a487f11e95698cca736c55872bd4d1e27a915b93ee46f51f9771e8c SHA512 72b4363183c562708043fe6728bc475a4a92273e4707432d4d18c7c737bbc7707be5162923b7ee6e36cdd3eca1d8d4b68542d7162d399f0d60fb8dd6e35f1167
 DIST glibc-2.37-patches-7.tar.xz 67408 BLAKE2B 0ac88c420020f32a2447a6cd8e931c95cf9438003b504ee69c5f4af551e060dd49919367d1554d99ed7dad331116e57dde8ce94975f1d1920141c13a16666236 SHA512 0de4ac41eff88f23a1b2d824219356443d79ecf1a08139028bba40a12b730df0f7df84d660b366ecd0a1801f708eff070bc121ab04cdad87a9498802b1c174c0
+DIST glibc-2.37-patches-8.tar.xz 70068 BLAKE2B e6e52f0df8d214fb9ece42b3fef4747b6a3fe1ea5f32390a5def309f5ae7f944e95b6942cc99197ad8e250e89f959853fb3269c7ed66fe7ecbd0110c6486526a SHA512 e6c7d8e5a269d3d8edc45c1ab168779c905b790ae56265b59976a8296dc9ab620fa08488087f12db4de8b866d37c3657554c315cbc212fd09cb96f0e027b9461
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-2.tar.xz 25512 BLAKE2B d7827f25017e7a2391442db42f21b7f365faa9da508cba19ae597ae69b7b20c93e8fe4b4a9a64af21153afe88e8ae2d358aca5819a42d8c42b2c82cdebbcaa33 SHA512 de5843108a2ba411c58ea7c2d3c1aa8eed91589ed286ae89e954fdc1dd14c36825864283764131795e5005290e2ba627a85f2c775d8aedbd920f669be66077ad
 DIST glibc-2.38-patches-3.tar.xz 44784 BLAKE2B 59d94b83d95fb9eea177409180e90352c0eeca65959951377ec80f0d29c43d71f7000d1e7302fc1f4ecd2d742582fc1f4d4afb2db056c959fca3da8b7c79dfae SHA512 14c19d1970678ecc5eabb86de3a46c1866acbfec96e7aaa334b3cb5b10446ae9d2f3337943473a35fe8bef9c382a0bdc341fc95ff01ff668a178e9c05cc2ded6

diff --git a/sys-libs/glibc/glibc-2.37-r6.ebuild b/sys-libs/glibc/glibc-2.37-r6.ebuild
new file mode 100644
index 000000000000..82974a07b796
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.37-r6.ebuild
@@ -0,0 +1,1680 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..11} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=8
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	tst-sched1
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-09-29 20:10 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-09-29 20:10 UTC (permalink / raw
  To: gentoo-commits

commit:     0240a9f6376e9aead9a558c75c583ffc7e8be19b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 29 20:09:26 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep 29 20:10:01 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0240a9f6

sys-libs/glibc: fix tests, patchlevel 2.37 9

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             | 2 +-
 sys-libs/glibc/glibc-2.37-r6.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index bf8c7018e43a..a40421c284aa 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,7 +20,7 @@ DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a59
 DIST glibc-2.37-patches-5.tar.xz 37640 BLAKE2B a87fb239208eb6d65c96bf7687570d8d0919277410fe1e28c293fa7749ffa862417bc1fe6d0819e47a806b20e52d14de84b843fa879fe15b884b2742719caf87 SHA512 344276606b7330322df72ee964d3447d02907df92b5a1d20b9aa427e93727be907f915ecd62db45e994c46451bd09d5da95ef7bf1a27d247a57589c568e6cb20
 DIST glibc-2.37-patches-6.tar.xz 47132 BLAKE2B a20c2390ef6342ac03abdf131f19221792cb9c7a050cdd5f87c9cfd2b6456edf60e7bfa14a487f11e95698cca736c55872bd4d1e27a915b93ee46f51f9771e8c SHA512 72b4363183c562708043fe6728bc475a4a92273e4707432d4d18c7c737bbc7707be5162923b7ee6e36cdd3eca1d8d4b68542d7162d399f0d60fb8dd6e35f1167
 DIST glibc-2.37-patches-7.tar.xz 67408 BLAKE2B 0ac88c420020f32a2447a6cd8e931c95cf9438003b504ee69c5f4af551e060dd49919367d1554d99ed7dad331116e57dde8ce94975f1d1920141c13a16666236 SHA512 0de4ac41eff88f23a1b2d824219356443d79ecf1a08139028bba40a12b730df0f7df84d660b366ecd0a1801f708eff070bc121ab04cdad87a9498802b1c174c0
-DIST glibc-2.37-patches-8.tar.xz 70068 BLAKE2B e6e52f0df8d214fb9ece42b3fef4747b6a3fe1ea5f32390a5def309f5ae7f944e95b6942cc99197ad8e250e89f959853fb3269c7ed66fe7ecbd0110c6486526a SHA512 e6c7d8e5a269d3d8edc45c1ab168779c905b790ae56265b59976a8296dc9ab620fa08488087f12db4de8b866d37c3657554c315cbc212fd09cb96f0e027b9461
+DIST glibc-2.37-patches-9.tar.xz 70472 BLAKE2B fa70bf7804623878e1027cf56c9c524f75bd61f4cfb5980ade45137b2ffbd0db9de244b2ba37b4af75d8ced4bf0f83feb6daff6af46367148a8c99c063dcd460 SHA512 d0afb53a05f44c051316f356ba3ee338ea5acceec2c28e07401e5f964d698696a15883ef02248ec84139d5e5fb57352e2d579e2a73e150399f641b8ccdc4d043
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-2.tar.xz 25512 BLAKE2B d7827f25017e7a2391442db42f21b7f365faa9da508cba19ae597ae69b7b20c93e8fe4b4a9a64af21153afe88e8ae2d358aca5819a42d8c42b2c82cdebbcaa33 SHA512 de5843108a2ba411c58ea7c2d3c1aa8eed91589ed286ae89e954fdc1dd14c36825864283764131795e5005290e2ba627a85f2c775d8aedbd920f669be66077ad
 DIST glibc-2.38-patches-3.tar.xz 44784 BLAKE2B 59d94b83d95fb9eea177409180e90352c0eeca65959951377ec80f0d29c43d71f7000d1e7302fc1f4ecd2d742582fc1f4d4afb2db056c959fca3da8b7c79dfae SHA512 14c19d1970678ecc5eabb86de3a46c1866acbfec96e7aaa334b3cb5b10446ae9d2f3337943473a35fe8bef9c382a0bdc341fc95ff01ff668a178e9c05cc2ded6

diff --git a/sys-libs/glibc/glibc-2.37-r6.ebuild b/sys-libs/glibc/glibc-2.37-r6.ebuild
index 82974a07b796..4d2841ba45fb 100644
--- a/sys-libs/glibc/glibc-2.37-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r6.ebuild
@@ -20,7 +20,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=8
+PATCH_VER=9
 PATCH_DEV=dilfridge
 
 # gcc mulitilib bootstrap files version


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-09-29 22:07 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-09-29 22:07 UTC (permalink / raw
  To: gentoo-commits

commit:     7b3ffb3e7d70b402ff0f3ef76295579b0445693d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 29 22:06:01 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep 29 22:06:01 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b3ffb3e

sys-libs/glibc: keyword 2.37-r6

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r6.ebuild b/sys-libs/glibc/glibc-2.37-r6.ebuild
index 4d2841ba45fb..b5718246ac33 100644
--- a/sys-libs/glibc/glibc-2.37-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r6.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-09-29 22:07 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-09-29 22:07 UTC (permalink / raw
  To: gentoo-commits

commit:     8efd2c49b9610a472fe14b01190bfa354e4f77a7
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 29 22:07:34 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep 29 22:07:34 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8efd2c49

sys-libs/glibc: drop 2.37-r4, 2.38-r1, 2.38-r3

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 -
 sys-libs/glibc/glibc-2.37-r4.ebuild | 1680 ----------------------------------
 sys-libs/glibc/glibc-2.38-r1.ebuild | 1680 ----------------------------------
 sys-libs/glibc/glibc-2.38-r3.ebuild | 1707 -----------------------------------
 4 files changed, 5069 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index a40421c284aa..e51b36dd57d4 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,11 +18,9 @@ DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c5240
 DIST glibc-2.36-patches-10.tar.xz 118268 BLAKE2B 3d1bdb6c1a9e10ba78a344ca8940f68c49411a94aefd4d66bab17d784bc8783f2ae71efb171dea6d1919ea2c4a1f54333dabc2c4d99838ba8ec568484b84d0ae SHA512 b88dfc56ffc2df495e13cf90e709629db2b9b411a1c5ba6d39f40f45be3c2f49df7b1fe320d1cd7552515fe68dfc644c12916a6db34139ccf94ff755235d3a40
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-2.37-patches-5.tar.xz 37640 BLAKE2B a87fb239208eb6d65c96bf7687570d8d0919277410fe1e28c293fa7749ffa862417bc1fe6d0819e47a806b20e52d14de84b843fa879fe15b884b2742719caf87 SHA512 344276606b7330322df72ee964d3447d02907df92b5a1d20b9aa427e93727be907f915ecd62db45e994c46451bd09d5da95ef7bf1a27d247a57589c568e6cb20
-DIST glibc-2.37-patches-6.tar.xz 47132 BLAKE2B a20c2390ef6342ac03abdf131f19221792cb9c7a050cdd5f87c9cfd2b6456edf60e7bfa14a487f11e95698cca736c55872bd4d1e27a915b93ee46f51f9771e8c SHA512 72b4363183c562708043fe6728bc475a4a92273e4707432d4d18c7c737bbc7707be5162923b7ee6e36cdd3eca1d8d4b68542d7162d399f0d60fb8dd6e35f1167
 DIST glibc-2.37-patches-7.tar.xz 67408 BLAKE2B 0ac88c420020f32a2447a6cd8e931c95cf9438003b504ee69c5f4af551e060dd49919367d1554d99ed7dad331116e57dde8ce94975f1d1920141c13a16666236 SHA512 0de4ac41eff88f23a1b2d824219356443d79ecf1a08139028bba40a12b730df0f7df84d660b366ecd0a1801f708eff070bc121ab04cdad87a9498802b1c174c0
 DIST glibc-2.37-patches-9.tar.xz 70472 BLAKE2B fa70bf7804623878e1027cf56c9c524f75bd61f4cfb5980ade45137b2ffbd0db9de244b2ba37b4af75d8ced4bf0f83feb6daff6af46367148a8c99c063dcd460 SHA512 d0afb53a05f44c051316f356ba3ee338ea5acceec2c28e07401e5f964d698696a15883ef02248ec84139d5e5fb57352e2d579e2a73e150399f641b8ccdc4d043
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
-DIST glibc-2.38-patches-2.tar.xz 25512 BLAKE2B d7827f25017e7a2391442db42f21b7f365faa9da508cba19ae597ae69b7b20c93e8fe4b4a9a64af21153afe88e8ae2d358aca5819a42d8c42b2c82cdebbcaa33 SHA512 de5843108a2ba411c58ea7c2d3c1aa8eed91589ed286ae89e954fdc1dd14c36825864283764131795e5005290e2ba627a85f2c775d8aedbd920f669be66077ad
 DIST glibc-2.38-patches-3.tar.xz 44784 BLAKE2B 59d94b83d95fb9eea177409180e90352c0eeca65959951377ec80f0d29c43d71f7000d1e7302fc1f4ecd2d742582fc1f4d4afb2db056c959fca3da8b7c79dfae SHA512 14c19d1970678ecc5eabb86de3a46c1866acbfec96e7aaa334b3cb5b10446ae9d2f3337943473a35fe8bef9c382a0bdc341fc95ff01ff668a178e9c05cc2ded6
 DIST glibc-2.38-patches-4.tar.xz 45480 BLAKE2B d5d311e444e7a0b827cb34ea6e9685da22eb08a2e944c161ff723ad9cc73131f3afc9ee4067e79bb80d456ab9846791b6b606b013fb53cf2515807c3abb8feea SHA512 473eaef7213b0ece8fa71bb88cfa0133ce8b455b572624a0f22aa0a59a80181ac5331282e4fe1b253e037e7d7f43f8071cbefc5fba1f8a22b048fbd477d79b13
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900

diff --git a/sys-libs/glibc/glibc-2.37-r4.ebuild b/sys-libs/glibc/glibc-2.37-r4.ebuild
deleted file mode 100644
index 28494cebf365..000000000000
--- a/sys-libs/glibc/glibc-2.37-r4.ebuild
+++ /dev/null
@@ -1,1680 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..11} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=6
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	tst-sched1
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.38-r1.ebuild b/sys-libs/glibc/glibc-2.38-r1.ebuild
deleted file mode 100644
index 6ad50eea426b..000000000000
--- a/sys-libs/glibc/glibc-2.38-r1.ebuild
+++ /dev/null
@@ -1,1680 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..12} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=2
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	tst-sched1
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.38-r3.ebuild b/sys-libs/glibc/glibc-2.38-r3.ebuild
deleted file mode 100644
index 2e8876560419..000000000000
--- a/sys-libs/glibc/glibc-2.38-r3.ebuild
+++ /dev/null
@@ -1,1707 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..12} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=3
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	KEYWORDS="~loong"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	tst-sched1
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-03 18:06 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-10-03 18:06 UTC (permalink / raw
  To: gentoo-commits

commit:     cf5480111cf4da127f6089fef7c2880e4f03cb48
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  3 18:05:32 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Oct  3 18:05:32 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf548011

sys-libs/glibc: 2.37 patchlevel 10 bump

Bug: https://bugs.gentoo.org/915127
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.37-r7.ebuild | 1680 +++++++++++++++++++++++++++++++++++
 2 files changed, 1681 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index e51b36dd57d4..609d57531b96 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,6 +17,7 @@ DIST glibc-2.35-patches-12.tar.xz 266056 BLAKE2B 7979dcfee270107d51c10e5ec74c9c1
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-2.36-patches-10.tar.xz 118268 BLAKE2B 3d1bdb6c1a9e10ba78a344ca8940f68c49411a94aefd4d66bab17d784bc8783f2ae71efb171dea6d1919ea2c4a1f54333dabc2c4d99838ba8ec568484b84d0ae SHA512 b88dfc56ffc2df495e13cf90e709629db2b9b411a1c5ba6d39f40f45be3c2f49df7b1fe320d1cd7552515fe68dfc644c12916a6db34139ccf94ff755235d3a40
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
+DIST glibc-2.37-patches-10.tar.xz 72768 BLAKE2B 20501519a570a5d277a3c1460373edea4131602b07037a81d855f1dcbc5b8d40fa6edae500a9f30e9541389dc1b4a7406cbee8e8a85a3131932e23f807e1b211 SHA512 f1e3791befa98ec5a83c919f6563c4c0c9e7bb2bf53bd0adf9235344d914a8d127f2da595a6850fd75b6828a81914241f8964bf004070888fbc77795f0f727cc
 DIST glibc-2.37-patches-5.tar.xz 37640 BLAKE2B a87fb239208eb6d65c96bf7687570d8d0919277410fe1e28c293fa7749ffa862417bc1fe6d0819e47a806b20e52d14de84b843fa879fe15b884b2742719caf87 SHA512 344276606b7330322df72ee964d3447d02907df92b5a1d20b9aa427e93727be907f915ecd62db45e994c46451bd09d5da95ef7bf1a27d247a57589c568e6cb20
 DIST glibc-2.37-patches-7.tar.xz 67408 BLAKE2B 0ac88c420020f32a2447a6cd8e931c95cf9438003b504ee69c5f4af551e060dd49919367d1554d99ed7dad331116e57dde8ce94975f1d1920141c13a16666236 SHA512 0de4ac41eff88f23a1b2d824219356443d79ecf1a08139028bba40a12b730df0f7df84d660b366ecd0a1801f708eff070bc121ab04cdad87a9498802b1c174c0
 DIST glibc-2.37-patches-9.tar.xz 70472 BLAKE2B fa70bf7804623878e1027cf56c9c524f75bd61f4cfb5980ade45137b2ffbd0db9de244b2ba37b4af75d8ced4bf0f83feb6daff6af46367148a8c99c063dcd460 SHA512 d0afb53a05f44c051316f356ba3ee338ea5acceec2c28e07401e5f964d698696a15883ef02248ec84139d5e5fb57352e2d579e2a73e150399f641b8ccdc4d043

diff --git a/sys-libs/glibc/glibc-2.37-r7.ebuild b/sys-libs/glibc/glibc-2.37-r7.ebuild
new file mode 100644
index 000000000000..2532b958061b
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.37-r7.ebuild
@@ -0,0 +1,1680 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..11} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=10
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	tst-sched1
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-03 18:11 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-10-03 18:11 UTC (permalink / raw
  To: gentoo-commits

commit:     0e9ec2c1795c6528ca1ef440a45b0be7d3ff2d6e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  3 18:11:18 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Oct  3 18:11:45 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0e9ec2c1

sys-libs/glibc: 2.38 patchlevel 5 bump

Bug: https://bugs.gentoo.org/915127
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.38-r5.ebuild | 1706 +++++++++++++++++++++++++++++++++++
 2 files changed, 1707 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 609d57531b96..d67ea697e8b6 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -24,6 +24,7 @@ DIST glibc-2.37-patches-9.tar.xz 70472 BLAKE2B fa70bf7804623878e1027cf56c9c524f7
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-3.tar.xz 44784 BLAKE2B 59d94b83d95fb9eea177409180e90352c0eeca65959951377ec80f0d29c43d71f7000d1e7302fc1f4ecd2d742582fc1f4d4afb2db056c959fca3da8b7c79dfae SHA512 14c19d1970678ecc5eabb86de3a46c1866acbfec96e7aaa334b3cb5b10446ae9d2f3337943473a35fe8bef9c382a0bdc341fc95ff01ff668a178e9c05cc2ded6
 DIST glibc-2.38-patches-4.tar.xz 45480 BLAKE2B d5d311e444e7a0b827cb34ea6e9685da22eb08a2e944c161ff723ad9cc73131f3afc9ee4067e79bb80d456ab9846791b6b606b013fb53cf2515807c3abb8feea SHA512 473eaef7213b0ece8fa71bb88cfa0133ce8b455b572624a0f22aa0a59a80181ac5331282e4fe1b253e037e7d7f43f8071cbefc5fba1f8a22b048fbd477d79b13
+DIST glibc-2.38-patches-5.tar.xz 47980 BLAKE2B 351c72079c7eea7432357ccb7d6f379d6ec3424faf1d455920e9538ab40522ba455a4a188862028d883343e43cec1badc7e195937c909f9b75cd60eb21cb0618 SHA512 5b24801aea6e03857d4e58050d5eb9e479bcab1a556a005195d975e051c39194b7cd2ab6b432a890fba12cdb45ff0507592105562b613b9dea67f11c87bbd939
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.38-r5.ebuild b/sys-libs/glibc/glibc-2.38-r5.ebuild
new file mode 100644
index 000000000000..43f89d315fbd
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.38-r5.ebuild
@@ -0,0 +1,1706 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..12} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=5
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	tst-sched1
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# we give the tests a bit more time to avoid spurious
+	# bug reports on slow arches
+
+	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-03 21:13 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-10-03 21:13 UTC (permalink / raw
  To: gentoo-commits

commit:     9dac73faec799d2c7240f5545582cf70b8e33c49
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  3 21:13:19 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Oct  3 21:13:45 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9dac73fa

sys-libs/glibc: keyword 2.37-r7

Bug: https://bugs.gentoo.org/915127
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r7.ebuild b/sys-libs/glibc/glibc-2.37-r7.ebuild
index 2532b958061b..5db7931d9f35 100644
--- a/sys-libs/glibc/glibc-2.37-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r7.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-03 21:41 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-10-03 21:41 UTC (permalink / raw
  To: gentoo-commits

commit:     7d47811b1b91485d359aa8bdeab275a82a105e73
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  3 21:41:08 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct  3 21:41:08 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7d47811b

sys-libs/glibc: keyword 2.38-r5

Bug: https://bugs.gentoo.org/915127
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r5.ebuild b/sys-libs/glibc/glibc-2.38-r5.ebuild
index 43f89d315fbd..a90f1984beaa 100644
--- a/sys-libs/glibc/glibc-2.38-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r5.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-03 21:45 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-10-03 21:45 UTC (permalink / raw
  To: gentoo-commits

commit:     7e2a4735a820160c1fb1eda6b61fe067b013ce39
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  3 21:45:00 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct  3 21:45:00 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7e2a4735

sys-libs/glibc: Stabilize 2.37-r7 amd64, #915142

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r7.ebuild b/sys-libs/glibc/glibc-2.37-r7.ebuild
index 5db7931d9f35..e461d37b5546 100644
--- a/sys-libs/glibc/glibc-2.37-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r7.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-03 22:15 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-10-03 22:15 UTC (permalink / raw
  To: gentoo-commits

commit:     618ac908e66aa70399760b65fe497431f477390a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  3 22:15:13 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct  3 22:15:13 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=618ac908

sys-libs/glibc: Stabilize 2.37-r7 arm64, #915142

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r7.ebuild b/sys-libs/glibc/glibc-2.37-r7.ebuild
index e461d37b5546..9aded4ce6803 100644
--- a/sys-libs/glibc/glibc-2.37-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r7.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-03 22:28 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-10-03 22:28 UTC (permalink / raw
  To: gentoo-commits

commit:     9358d97b6e81483507774ffd5143ddc73f880d9a
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  3 22:28:06 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Oct  3 22:28:06 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9358d97b

sys-libs/glibc: drop 2.37-r5, 2.37-r6, 2.38-r2, 2.38-r4

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    4 -
 sys-libs/glibc/glibc-2.37-r5.ebuild | 1680 ----------------------------------
 sys-libs/glibc/glibc-2.37-r6.ebuild | 1680 ----------------------------------
 sys-libs/glibc/glibc-2.38-r2.ebuild | 1680 ----------------------------------
 sys-libs/glibc/glibc-2.38-r4.ebuild | 1706 -----------------------------------
 5 files changed, 6750 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index d67ea697e8b6..c3af0ec84403 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,11 +19,7 @@ DIST glibc-2.36-patches-10.tar.xz 118268 BLAKE2B 3d1bdb6c1a9e10ba78a344ca8940f68
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-2.37-patches-10.tar.xz 72768 BLAKE2B 20501519a570a5d277a3c1460373edea4131602b07037a81d855f1dcbc5b8d40fa6edae500a9f30e9541389dc1b4a7406cbee8e8a85a3131932e23f807e1b211 SHA512 f1e3791befa98ec5a83c919f6563c4c0c9e7bb2bf53bd0adf9235344d914a8d127f2da595a6850fd75b6828a81914241f8964bf004070888fbc77795f0f727cc
 DIST glibc-2.37-patches-5.tar.xz 37640 BLAKE2B a87fb239208eb6d65c96bf7687570d8d0919277410fe1e28c293fa7749ffa862417bc1fe6d0819e47a806b20e52d14de84b843fa879fe15b884b2742719caf87 SHA512 344276606b7330322df72ee964d3447d02907df92b5a1d20b9aa427e93727be907f915ecd62db45e994c46451bd09d5da95ef7bf1a27d247a57589c568e6cb20
-DIST glibc-2.37-patches-7.tar.xz 67408 BLAKE2B 0ac88c420020f32a2447a6cd8e931c95cf9438003b504ee69c5f4af551e060dd49919367d1554d99ed7dad331116e57dde8ce94975f1d1920141c13a16666236 SHA512 0de4ac41eff88f23a1b2d824219356443d79ecf1a08139028bba40a12b730df0f7df84d660b366ecd0a1801f708eff070bc121ab04cdad87a9498802b1c174c0
-DIST glibc-2.37-patches-9.tar.xz 70472 BLAKE2B fa70bf7804623878e1027cf56c9c524f75bd61f4cfb5980ade45137b2ffbd0db9de244b2ba37b4af75d8ced4bf0f83feb6daff6af46367148a8c99c063dcd460 SHA512 d0afb53a05f44c051316f356ba3ee338ea5acceec2c28e07401e5f964d698696a15883ef02248ec84139d5e5fb57352e2d579e2a73e150399f641b8ccdc4d043
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
-DIST glibc-2.38-patches-3.tar.xz 44784 BLAKE2B 59d94b83d95fb9eea177409180e90352c0eeca65959951377ec80f0d29c43d71f7000d1e7302fc1f4ecd2d742582fc1f4d4afb2db056c959fca3da8b7c79dfae SHA512 14c19d1970678ecc5eabb86de3a46c1866acbfec96e7aaa334b3cb5b10446ae9d2f3337943473a35fe8bef9c382a0bdc341fc95ff01ff668a178e9c05cc2ded6
-DIST glibc-2.38-patches-4.tar.xz 45480 BLAKE2B d5d311e444e7a0b827cb34ea6e9685da22eb08a2e944c161ff723ad9cc73131f3afc9ee4067e79bb80d456ab9846791b6b606b013fb53cf2515807c3abb8feea SHA512 473eaef7213b0ece8fa71bb88cfa0133ce8b455b572624a0f22aa0a59a80181ac5331282e4fe1b253e037e7d7f43f8071cbefc5fba1f8a22b048fbd477d79b13
 DIST glibc-2.38-patches-5.tar.xz 47980 BLAKE2B 351c72079c7eea7432357ccb7d6f379d6ec3424faf1d455920e9538ab40522ba455a4a188862028d883343e43cec1badc7e195937c909f9b75cd60eb21cb0618 SHA512 5b24801aea6e03857d4e58050d5eb9e479bcab1a556a005195d975e051c39194b7cd2ab6b432a890fba12cdb45ff0507592105562b613b9dea67f11c87bbd939
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238

diff --git a/sys-libs/glibc/glibc-2.37-r5.ebuild b/sys-libs/glibc/glibc-2.37-r5.ebuild
deleted file mode 100644
index db0c8e76b286..000000000000
--- a/sys-libs/glibc/glibc-2.37-r5.ebuild
+++ /dev/null
@@ -1,1680 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..11} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=7
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	tst-sched1
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.37-r6.ebuild b/sys-libs/glibc/glibc-2.37-r6.ebuild
deleted file mode 100644
index b5718246ac33..000000000000
--- a/sys-libs/glibc/glibc-2.37-r6.ebuild
+++ /dev/null
@@ -1,1680 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..11} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=9
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	tst-sched1
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.38-r2.ebuild b/sys-libs/glibc/glibc-2.38-r2.ebuild
deleted file mode 100644
index 8af1710c2a35..000000000000
--- a/sys-libs/glibc/glibc-2.38-r2.ebuild
+++ /dev/null
@@ -1,1680 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..12} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=3
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	tst-sched1
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.38-r4.ebuild b/sys-libs/glibc/glibc-2.38-r4.ebuild
deleted file mode 100644
index 3860a4b1b2e1..000000000000
--- a/sys-libs/glibc/glibc-2.38-r4.ebuild
+++ /dev/null
@@ -1,1706 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..12} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=4
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	tst-sched1
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# we give the tests a bit more time to avoid spurious
-	# bug reports on slow arches
-
-	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-03 23:04 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-10-03 23:04 UTC (permalink / raw
  To: gentoo-commits

commit:     b7694565ded736a2317082fa54b51228f1ac3f14
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  3 23:04:08 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct  3 23:04:08 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b7694565

sys-libs/glibc: Stabilize 2.37-r7 ppc64, #915142

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r7.ebuild b/sys-libs/glibc/glibc-2.37-r7.ebuild
index 9aded4ce6803..3e91284cd3ab 100644
--- a/sys-libs/glibc/glibc-2.37-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r7.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-03 23:07 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-10-03 23:07 UTC (permalink / raw
  To: gentoo-commits

commit:     ac09e829148b32682547b21a1a774172aabaede2
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  3 23:07:38 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct  3 23:07:38 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ac09e829

sys-libs/glibc: Stabilize 2.37-r7 x86, #915142

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r7.ebuild b/sys-libs/glibc/glibc-2.37-r7.ebuild
index 3e91284cd3ab..40cdf40913db 100644
--- a/sys-libs/glibc/glibc-2.37-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r7.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-04 18:32 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2023-10-04 18:32 UTC (permalink / raw
  To: gentoo-commits

commit:     0964ab9eb0aba1a299d24fabb80d977ea53d15de
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  4 18:32:48 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Wed Oct  4 18:32:48 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0964ab9e

sys-libs/glibc: Stabilize 2.37-r7 ppc, #915142

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r7.ebuild b/sys-libs/glibc/glibc-2.37-r7.ebuild
index 40cdf40913db..d7e28159bcd6 100644
--- a/sys-libs/glibc/glibc-2.37-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r7.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-13 15:11 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-10-13 15:11 UTC (permalink / raw
  To: gentoo-commits

commit:     1a6b4b253ba1ba7935c711ddf186b3f3642e7004
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Fri Oct 13 12:37:40 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct 13 15:11:20 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1a6b4b25

sys-libs/glibc: stable 2.37-r7 for hppa, bug #915142

Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r7.ebuild b/sys-libs/glibc/glibc-2.37-r7.ebuild
index d7e28159bcd6..048225f8328f 100644
--- a/sys-libs/glibc/glibc-2.37-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r7.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-15 15:23 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-10-15 15:23 UTC (permalink / raw
  To: gentoo-commits

commit:     35f8a7741e22215786024c078f0fdbd5da1bf7be
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Sun Oct 15 14:52:07 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 15 15:22:41 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=35f8a774

sys-libs/glibc: stable 2.37-r7 for sparc, bug #915142

Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r7.ebuild b/sys-libs/glibc/glibc-2.37-r7.ebuild
index 048225f8328f..b48b97abae1c 100644
--- a/sys-libs/glibc/glibc-2.37-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r7.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-18 10:02 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-10-18 10:02 UTC (permalink / raw
  To: gentoo-commits

commit:     5e9f0ff729d4a7ce92f1aa56759b6302c87452c5
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 18 10:01:58 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Oct 18 10:01:58 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5e9f0ff7

sys-libs/glibc: Stabilize 2.37-r7 arm, #915142

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r7.ebuild b/sys-libs/glibc/glibc-2.37-r7.ebuild
index b48b97abae1c..49ec055ee75e 100644
--- a/sys-libs/glibc/glibc-2.37-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r7.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-18 19:13 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-10-18 19:13 UTC (permalink / raw
  To: gentoo-commits

commit:     a845e3d9e497f09d24bb032cd1ee208e376a8727
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 18 19:11:00 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Oct 18 19:11:00 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a845e3d9

sys-libs/glibc: 2.38 patchlevel 6 bump

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.38-r6.ebuild | 1706 +++++++++++++++++++++++++++++++++++
 2 files changed, 1707 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index a76fe6dc5742..125152b4300d 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,6 +20,7 @@ DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a59
 DIST glibc-2.37-patches-10.tar.xz 72768 BLAKE2B 20501519a570a5d277a3c1460373edea4131602b07037a81d855f1dcbc5b8d40fa6edae500a9f30e9541389dc1b4a7406cbee8e8a85a3131932e23f807e1b211 SHA512 f1e3791befa98ec5a83c919f6563c4c0c9e7bb2bf53bd0adf9235344d914a8d127f2da595a6850fd75b6828a81914241f8964bf004070888fbc77795f0f727cc
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-5.tar.xz 47980 BLAKE2B 351c72079c7eea7432357ccb7d6f379d6ec3424faf1d455920e9538ab40522ba455a4a188862028d883343e43cec1badc7e195937c909f9b75cd60eb21cb0618 SHA512 5b24801aea6e03857d4e58050d5eb9e479bcab1a556a005195d975e051c39194b7cd2ab6b432a890fba12cdb45ff0507592105562b613b9dea67f11c87bbd939
+DIST glibc-2.38-patches-6.tar.xz 49680 BLAKE2B 2f929aaeebc06164ae6b1fa81ce149beb8467e3928a35f667c2b489c96de346d24020cf017c9e1a6942aa57c177f34637ca5bfe3aee7641702bb6c589b4b6283 SHA512 18d7f6216721c9ca75a3e759e30aa0429c57e296a1223b2a5a5bbdd26edf523a6bf509437d913b9c2b95ca1e41543a904b72a89afa444606d3b3949311341958
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.38-r6.ebuild b/sys-libs/glibc/glibc-2.38-r6.ebuild
new file mode 100644
index 000000000000..c12cca412cb1
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.38-r6.ebuild
@@ -0,0 +1,1706 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..12} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=6
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	tst-sched1
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# we give the tests a bit more time to avoid spurious
+	# bug reports on slow arches
+
+	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-18 19:13 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-10-18 19:13 UTC (permalink / raw
  To: gentoo-commits

commit:     51576885fbc70fa562d4181ccfb73ed62f516e52
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 18 19:09:34 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Oct 18 19:09:34 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=51576885

sys-libs/glibc: drop 2.37-r3

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.37-r3.ebuild | 1648 -----------------------------------
 2 files changed, 1649 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index c3af0ec84403..a76fe6dc5742 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,7 +18,6 @@ DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c5240
 DIST glibc-2.36-patches-10.tar.xz 118268 BLAKE2B 3d1bdb6c1a9e10ba78a344ca8940f68c49411a94aefd4d66bab17d784bc8783f2ae71efb171dea6d1919ea2c4a1f54333dabc2c4d99838ba8ec568484b84d0ae SHA512 b88dfc56ffc2df495e13cf90e709629db2b9b411a1c5ba6d39f40f45be3c2f49df7b1fe320d1cd7552515fe68dfc644c12916a6db34139ccf94ff755235d3a40
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-2.37-patches-10.tar.xz 72768 BLAKE2B 20501519a570a5d277a3c1460373edea4131602b07037a81d855f1dcbc5b8d40fa6edae500a9f30e9541389dc1b4a7406cbee8e8a85a3131932e23f807e1b211 SHA512 f1e3791befa98ec5a83c919f6563c4c0c9e7bb2bf53bd0adf9235344d914a8d127f2da595a6850fd75b6828a81914241f8964bf004070888fbc77795f0f727cc
-DIST glibc-2.37-patches-5.tar.xz 37640 BLAKE2B a87fb239208eb6d65c96bf7687570d8d0919277410fe1e28c293fa7749ffa862417bc1fe6d0819e47a806b20e52d14de84b843fa879fe15b884b2742719caf87 SHA512 344276606b7330322df72ee964d3447d02907df92b5a1d20b9aa427e93727be907f915ecd62db45e994c46451bd09d5da95ef7bf1a27d247a57589c568e6cb20
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-5.tar.xz 47980 BLAKE2B 351c72079c7eea7432357ccb7d6f379d6ec3424faf1d455920e9538ab40522ba455a4a188862028d883343e43cec1badc7e195937c909f9b75cd60eb21cb0618 SHA512 5b24801aea6e03857d4e58050d5eb9e479bcab1a556a005195d975e051c39194b7cd2ab6b432a890fba12cdb45ff0507592105562b613b9dea67f11c87bbd939
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900

diff --git a/sys-libs/glibc/glibc-2.37-r3.ebuild b/sys-libs/glibc/glibc-2.37-r3.ebuild
deleted file mode 100644
index c3c9ca521d37..000000000000
--- a/sys-libs/glibc/glibc-2.37-r3.ebuild
+++ /dev/null
@@ -1,1648 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..11} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=5
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-18 19:13 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-10-18 19:13 UTC (permalink / raw
  To: gentoo-commits

commit:     c42d11a2b6f72769ad20cf495af750f75e77810b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 18 19:12:25 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Oct 18 19:12:25 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c42d11a2

sys-libs/glibc: 2.37 patchlevel 11 bump

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.37-r8.ebuild | 1680 +++++++++++++++++++++++++++++++++++
 2 files changed, 1681 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 125152b4300d..c6f1dacd152f 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -18,6 +18,7 @@ DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c5240
 DIST glibc-2.36-patches-10.tar.xz 118268 BLAKE2B 3d1bdb6c1a9e10ba78a344ca8940f68c49411a94aefd4d66bab17d784bc8783f2ae71efb171dea6d1919ea2c4a1f54333dabc2c4d99838ba8ec568484b84d0ae SHA512 b88dfc56ffc2df495e13cf90e709629db2b9b411a1c5ba6d39f40f45be3c2f49df7b1fe320d1cd7552515fe68dfc644c12916a6db34139ccf94ff755235d3a40
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-2.37-patches-10.tar.xz 72768 BLAKE2B 20501519a570a5d277a3c1460373edea4131602b07037a81d855f1dcbc5b8d40fa6edae500a9f30e9541389dc1b4a7406cbee8e8a85a3131932e23f807e1b211 SHA512 f1e3791befa98ec5a83c919f6563c4c0c9e7bb2bf53bd0adf9235344d914a8d127f2da595a6850fd75b6828a81914241f8964bf004070888fbc77795f0f727cc
+DIST glibc-2.37-patches-11.tar.xz 74472 BLAKE2B 25d17b1720b9ee955d176f3f42315ff386e706291fec3d7fe7910d428b878fca5986906b848755ffe74e7d108ac5aad836f403e40290ebae50a103691cb7ed66 SHA512 d5483fe1506cd1bd094e433177209ce2e8639081618582930538b3064ac1a72886074e4c0f10bf7beca2b871404f3d4c61e8f6aa2ba8c4166acfca65cc7a9af7
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-5.tar.xz 47980 BLAKE2B 351c72079c7eea7432357ccb7d6f379d6ec3424faf1d455920e9538ab40522ba455a4a188862028d883343e43cec1badc7e195937c909f9b75cd60eb21cb0618 SHA512 5b24801aea6e03857d4e58050d5eb9e479bcab1a556a005195d975e051c39194b7cd2ab6b432a890fba12cdb45ff0507592105562b613b9dea67f11c87bbd939
 DIST glibc-2.38-patches-6.tar.xz 49680 BLAKE2B 2f929aaeebc06164ae6b1fa81ce149beb8467e3928a35f667c2b489c96de346d24020cf017c9e1a6942aa57c177f34637ca5bfe3aee7641702bb6c589b4b6283 SHA512 18d7f6216721c9ca75a3e759e30aa0429c57e296a1223b2a5a5bbdd26edf523a6bf509437d913b9c2b95ca1e41543a904b72a89afa444606d3b3949311341958

diff --git a/sys-libs/glibc/glibc-2.37-r8.ebuild b/sys-libs/glibc/glibc-2.37-r8.ebuild
new file mode 100644
index 000000000000..cab8662398fc
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.37-r8.ebuild
@@ -0,0 +1,1680 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..11} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=11
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	tst-sched1
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-19  8:12 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-10-19  8:12 UTC (permalink / raw
  To: gentoo-commits

commit:     49d508bb455b6aa7edfcbbb68fd2a72093a19069
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 19 08:11:47 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Oct 19 08:12:05 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=49d508bb

sys-libs/glibc: keyword 2.37-r8

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r8.ebuild b/sys-libs/glibc/glibc-2.37-r8.ebuild
index cab8662398fc..b267d37bcf49 100644
--- a/sys-libs/glibc/glibc-2.37-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r8.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-19  8:14 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-10-19  8:14 UTC (permalink / raw
  To: gentoo-commits

commit:     e61060b3f2937875c09e416c91cf8d4a0213a4aa
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 19 08:14:17 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Oct 19 08:14:17 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e61060b3

sys-libs/glibc: keyword 2.38-r6

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r6.ebuild b/sys-libs/glibc/glibc-2.38-r6.ebuild
index c12cca412cb1..0dbe82eee65b 100644
--- a/sys-libs/glibc/glibc-2.38-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r6.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-26 20:49 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-10-26 20:49 UTC (permalink / raw
  To: gentoo-commits

commit:     3d9d1a1f20f88092f4eda5b97ebfb0f354773b32
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 26 20:47:45 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Oct 26 20:48:49 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d9d1a1f

sys-libs/glibc: 2.38 revbump, patchlevel 7

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.38-r7.ebuild | 1706 +++++++++++++++++++++++++++++++++++
 2 files changed, 1707 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index c6f1dacd152f..fe65f62467f6 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -22,6 +22,7 @@ DIST glibc-2.37-patches-11.tar.xz 74472 BLAKE2B 25d17b1720b9ee955d176f3f42315ff3
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-5.tar.xz 47980 BLAKE2B 351c72079c7eea7432357ccb7d6f379d6ec3424faf1d455920e9538ab40522ba455a4a188862028d883343e43cec1badc7e195937c909f9b75cd60eb21cb0618 SHA512 5b24801aea6e03857d4e58050d5eb9e479bcab1a556a005195d975e051c39194b7cd2ab6b432a890fba12cdb45ff0507592105562b613b9dea67f11c87bbd939
 DIST glibc-2.38-patches-6.tar.xz 49680 BLAKE2B 2f929aaeebc06164ae6b1fa81ce149beb8467e3928a35f667c2b489c96de346d24020cf017c9e1a6942aa57c177f34637ca5bfe3aee7641702bb6c589b4b6283 SHA512 18d7f6216721c9ca75a3e759e30aa0429c57e296a1223b2a5a5bbdd26edf523a6bf509437d913b9c2b95ca1e41543a904b72a89afa444606d3b3949311341958
+DIST glibc-2.38-patches-7.tar.xz 49276 BLAKE2B ef86c88540018bc7347ee57cc60138f010dd95e749f3c1c4ca196a9a707188851345fa41d00dacf25d7ed424486f75020af430e61b0a9bb74714976156bb35ae SHA512 5bad7ee804a2a0e31517c23f6a5eca82f00a695edccb3af81309ace8b441f1e2be704568660c87e8f4770f8d63cde272875d789c6fcbef61da534f7573851831
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.38-r7.ebuild b/sys-libs/glibc/glibc-2.38-r7.ebuild
new file mode 100644
index 000000000000..59f45cf9d469
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.38-r7.ebuild
@@ -0,0 +1,1706 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..12} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=7
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	tst-sched1
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# we give the tests a bit more time to avoid spurious
+	# bug reports on slow arches
+
+	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-27 20:12 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-10-27 20:12 UTC (permalink / raw
  To: gentoo-commits

commit:     fc8b8de231ec20cd7c1a003d1b5270a2949ed966
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 27 20:11:42 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Oct 27 20:12:20 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc8b8de2

sys-libs/glibc: disable aarch64 mathvec for headers-only

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r7.ebuild | 9 ++++++++-
 sys-libs/glibc/glibc-9999.ebuild    | 9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.38-r7.ebuild b/sys-libs/glibc/glibc-2.38-r7.ebuild
index 59f45cf9d469..6326864811df 100644
--- a/sys-libs/glibc/glibc-2.38-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r7.ebuild
@@ -1165,7 +1165,15 @@ glibc_headers_configure() {
 		popd >/dev/null
 	fi
 
+	local myconf=()
+
 	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
 	riscv*)
 		# RISC-V interrogates the compiler to determine which target to
 		# build.  If building the headers then we don't strictly need a
@@ -1184,7 +1192,6 @@ glibc_headers_configure() {
 		) ;;
 	esac
 
-	local myconf=()
 	myconf+=(
 		--disable-sanity-checks
 		--enable-hacker-mode

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 41218b9c69d0..512e39736db4 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1165,7 +1165,15 @@ glibc_headers_configure() {
 		popd >/dev/null
 	fi
 
+	local myconf=()
+
 	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
 	riscv*)
 		# RISC-V interrogates the compiler to determine which target to
 		# build.  If building the headers then we don't strictly need a
@@ -1184,7 +1192,6 @@ glibc_headers_configure() {
 		) ;;
 	esac
 
-	local myconf=()
 	myconf+=(
 		--disable-sanity-checks
 		--enable-hacker-mode


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-28 15:47 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-10-28 15:47 UTC (permalink / raw
  To: gentoo-commits

commit:     725d20443c668068596f716d57a224676bf78867
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 28 15:47:25 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 28 15:47:25 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=725d2044

sys-libs/glibc: drop 2.38-r5

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.38-r5.ebuild | 1706 -----------------------------------
 2 files changed, 1707 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index fe65f62467f6..faf9c82a147a 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,7 +20,6 @@ DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a59
 DIST glibc-2.37-patches-10.tar.xz 72768 BLAKE2B 20501519a570a5d277a3c1460373edea4131602b07037a81d855f1dcbc5b8d40fa6edae500a9f30e9541389dc1b4a7406cbee8e8a85a3131932e23f807e1b211 SHA512 f1e3791befa98ec5a83c919f6563c4c0c9e7bb2bf53bd0adf9235344d914a8d127f2da595a6850fd75b6828a81914241f8964bf004070888fbc77795f0f727cc
 DIST glibc-2.37-patches-11.tar.xz 74472 BLAKE2B 25d17b1720b9ee955d176f3f42315ff386e706291fec3d7fe7910d428b878fca5986906b848755ffe74e7d108ac5aad836f403e40290ebae50a103691cb7ed66 SHA512 d5483fe1506cd1bd094e433177209ce2e8639081618582930538b3064ac1a72886074e4c0f10bf7beca2b871404f3d4c61e8f6aa2ba8c4166acfca65cc7a9af7
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
-DIST glibc-2.38-patches-5.tar.xz 47980 BLAKE2B 351c72079c7eea7432357ccb7d6f379d6ec3424faf1d455920e9538ab40522ba455a4a188862028d883343e43cec1badc7e195937c909f9b75cd60eb21cb0618 SHA512 5b24801aea6e03857d4e58050d5eb9e479bcab1a556a005195d975e051c39194b7cd2ab6b432a890fba12cdb45ff0507592105562b613b9dea67f11c87bbd939
 DIST glibc-2.38-patches-6.tar.xz 49680 BLAKE2B 2f929aaeebc06164ae6b1fa81ce149beb8467e3928a35f667c2b489c96de346d24020cf017c9e1a6942aa57c177f34637ca5bfe3aee7641702bb6c589b4b6283 SHA512 18d7f6216721c9ca75a3e759e30aa0429c57e296a1223b2a5a5bbdd26edf523a6bf509437d913b9c2b95ca1e41543a904b72a89afa444606d3b3949311341958
 DIST glibc-2.38-patches-7.tar.xz 49276 BLAKE2B ef86c88540018bc7347ee57cc60138f010dd95e749f3c1c4ca196a9a707188851345fa41d00dacf25d7ed424486f75020af430e61b0a9bb74714976156bb35ae SHA512 5bad7ee804a2a0e31517c23f6a5eca82f00a695edccb3af81309ace8b441f1e2be704568660c87e8f4770f8d63cde272875d789c6fcbef61da534f7573851831
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900

diff --git a/sys-libs/glibc/glibc-2.38-r5.ebuild b/sys-libs/glibc/glibc-2.38-r5.ebuild
deleted file mode 100644
index a90f1984beaa..000000000000
--- a/sys-libs/glibc/glibc-2.38-r5.ebuild
+++ /dev/null
@@ -1,1706 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..12} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=5
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	tst-sched1
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# we give the tests a bit more time to avoid spurious
-	# bug reports on slow arches
-
-	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-10-28 15:47 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-10-28 15:47 UTC (permalink / raw
  To: gentoo-commits

commit:     d8a83614e9c2e962a9de9ab905881d2abd1b0aa6
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 28 15:46:55 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 28 15:46:55 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d8a83614

sys-libs/glibc: keyword 2.38-r7

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r7.ebuild b/sys-libs/glibc/glibc-2.38-r7.ebuild
index 6326864811df..6805f991b469 100644
--- a/sys-libs/glibc/glibc-2.38-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r7.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-12-23 17:09 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-12-23 17:09 UTC (permalink / raw
  To: gentoo-commits

commit:     bc1005e2ce8cc62e7be870adda64f630098d74db
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 23 17:06:33 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Dec 23 17:09:20 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bc1005e2

sys-libs/glibc: 2.38 patchlevel 8 bump

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.38-r8.ebuild | 1713 +++++++++++++++++++++++++++++++++++
 2 files changed, 1714 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index faf9c82a147a..231539fe162e 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -22,6 +22,7 @@ DIST glibc-2.37-patches-11.tar.xz 74472 BLAKE2B 25d17b1720b9ee955d176f3f42315ff3
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-6.tar.xz 49680 BLAKE2B 2f929aaeebc06164ae6b1fa81ce149beb8467e3928a35f667c2b489c96de346d24020cf017c9e1a6942aa57c177f34637ca5bfe3aee7641702bb6c589b4b6283 SHA512 18d7f6216721c9ca75a3e759e30aa0429c57e296a1223b2a5a5bbdd26edf523a6bf509437d913b9c2b95ca1e41543a904b72a89afa444606d3b3949311341958
 DIST glibc-2.38-patches-7.tar.xz 49276 BLAKE2B ef86c88540018bc7347ee57cc60138f010dd95e749f3c1c4ca196a9a707188851345fa41d00dacf25d7ed424486f75020af430e61b0a9bb74714976156bb35ae SHA512 5bad7ee804a2a0e31517c23f6a5eca82f00a695edccb3af81309ace8b441f1e2be704568660c87e8f4770f8d63cde272875d789c6fcbef61da534f7573851831
+DIST glibc-2.38-patches-8.tar.xz 56336 BLAKE2B ad3948ed3fc41bac27600306cec65a921192d73287d3bfcaa8f5663870e8249f8a44a7adaf9f615c47b611d6c9bee3b220a851aab72560d786bcd116dd853eff SHA512 722d8a33131f84a9b0674347368f9c0994417411228d44316806ad40ab2bbfb933ad094a15b16541de8522115d6d78aed5a36de45d38ef5c1656b64c3ede8c99
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.38-r8.ebuild b/sys-libs/glibc/glibc-2.38-r8.ebuild
new file mode 100644
index 000000000000..57cad07312a1
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.38-r8.ebuild
@@ -0,0 +1,1713 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..12} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=8
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	tst-sched1
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# we give the tests a bit more time to avoid spurious
+	# bug reports on slow arches
+
+	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-12-23 18:22 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2023-12-23 18:22 UTC (permalink / raw
  To: gentoo-commits

commit:     111defb327a4eeac2e5d1f3bcbf111000c6db317
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 23 18:21:25 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Dec 23 18:21:25 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=111defb3

sys-libs/glibc: always skip tst-sched1

It fails outside of nspawn if PORTAGE_NICENESS or PORTAGE_SCHEDULING_POLICY is
set in some cases as it lacks privileges to adjust it down further.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r8.ebuild | 3 ++-
 sys-libs/glibc/glibc-9999.ebuild    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.38-r8.ebuild b/sys-libs/glibc/glibc-2.38-r8.ebuild
index 57cad07312a1..761dd1811b0a 100644
--- a/sys-libs/glibc/glibc-2.38-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r8.ebuild
@@ -168,6 +168,8 @@ XFAIL_TEST_LIST=(
 	tst-system
 	tst-strerror
 	tst-strsignal
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
 )
 
 XFAIL_NSPAWN_TEST_LIST=(
@@ -190,7 +192,6 @@ XFAIL_NSPAWN_TEST_LIST=(
 
 	# These fail if --suppress-sync and/or low priority is set
 	tst-sync_file_range
-	tst-sched1
 	test-errno
 )
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 512e39736db4..72861bd7fa19 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -168,6 +168,8 @@ XFAIL_TEST_LIST=(
 	tst-system
 	tst-strerror
 	tst-strsignal
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
 )
 
 XFAIL_NSPAWN_TEST_LIST=(
@@ -190,7 +192,6 @@ XFAIL_NSPAWN_TEST_LIST=(
 
 	# These fail if --suppress-sync and/or low priority is set
 	tst-sync_file_range
-	tst-sched1
 	test-errno
 )
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-12-23 22:03 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-12-23 22:03 UTC (permalink / raw
  To: gentoo-commits

commit:     6d720408246f741c0e65e0ad6fa1eb8f2e14ba03
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 23 22:02:54 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Dec 23 22:03:36 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d720408

sys-libs/glibc: bump to patchlevel 9, only a test disabled

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             | 2 +-
 sys-libs/glibc/glibc-2.38-r8.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 231539fe162e..610607731e75 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -22,7 +22,7 @@ DIST glibc-2.37-patches-11.tar.xz 74472 BLAKE2B 25d17b1720b9ee955d176f3f42315ff3
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-6.tar.xz 49680 BLAKE2B 2f929aaeebc06164ae6b1fa81ce149beb8467e3928a35f667c2b489c96de346d24020cf017c9e1a6942aa57c177f34637ca5bfe3aee7641702bb6c589b4b6283 SHA512 18d7f6216721c9ca75a3e759e30aa0429c57e296a1223b2a5a5bbdd26edf523a6bf509437d913b9c2b95ca1e41543a904b72a89afa444606d3b3949311341958
 DIST glibc-2.38-patches-7.tar.xz 49276 BLAKE2B ef86c88540018bc7347ee57cc60138f010dd95e749f3c1c4ca196a9a707188851345fa41d00dacf25d7ed424486f75020af430e61b0a9bb74714976156bb35ae SHA512 5bad7ee804a2a0e31517c23f6a5eca82f00a695edccb3af81309ace8b441f1e2be704568660c87e8f4770f8d63cde272875d789c6fcbef61da534f7573851831
-DIST glibc-2.38-patches-8.tar.xz 56336 BLAKE2B ad3948ed3fc41bac27600306cec65a921192d73287d3bfcaa8f5663870e8249f8a44a7adaf9f615c47b611d6c9bee3b220a851aab72560d786bcd116dd853eff SHA512 722d8a33131f84a9b0674347368f9c0994417411228d44316806ad40ab2bbfb933ad094a15b16541de8522115d6d78aed5a36de45d38ef5c1656b64c3ede8c99
+DIST glibc-2.38-patches-9.tar.xz 56716 BLAKE2B 07d814a0715561995495d27164fe40155e4bf424a52e571005669a148cfc23cee136a439c3a8d441b67062f169b4b4f67df76549c922f2c5d87def07de067561 SHA512 a33c65a9fb56fab39a1656e4bf359525d52a26ffcf6648f60a72e94c1b6b569eb25b3c46502f43a7aabfbb6507c9ce24def3ebd7069e23d583a029c91f0984e7
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.38-r8.ebuild b/sys-libs/glibc/glibc-2.38-r8.ebuild
index 761dd1811b0a..6443166a7e06 100644
--- a/sys-libs/glibc/glibc-2.38-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r8.ebuild
@@ -20,7 +20,7 @@ SLOT="2.2"
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=8
+PATCH_VER=9
 PATCH_DEV=dilfridge
 
 # gcc mulitilib bootstrap files version


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-12-25 20:03 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-12-25 20:03 UTC (permalink / raw
  To: gentoo-commits

commit:     59104404fb2d889d619f388363b9df8b9910e567
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 25 20:02:32 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Dec 25 20:02:32 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59104404

sys-libs/glibc: keyword 2.38-r8

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r8.ebuild b/sys-libs/glibc/glibc-2.38-r8.ebuild
index 6443166a7e06..e9a58b8e1293 100644
--- a/sys-libs/glibc/glibc-2.38-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r8.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2023-12-25 20:03 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2023-12-25 20:03 UTC (permalink / raw
  To: gentoo-commits

commit:     4da1e383ed7c8ada6d62ce1d03b11f8f5e30da1e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 25 20:02:59 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Dec 25 20:02:59 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4da1e383

sys-libs/glibc: drop 2.38-r6

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.38-r6.ebuild | 1706 -----------------------------------
 2 files changed, 1707 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 610607731e75..88dd83cffd65 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,7 +20,6 @@ DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a59
 DIST glibc-2.37-patches-10.tar.xz 72768 BLAKE2B 20501519a570a5d277a3c1460373edea4131602b07037a81d855f1dcbc5b8d40fa6edae500a9f30e9541389dc1b4a7406cbee8e8a85a3131932e23f807e1b211 SHA512 f1e3791befa98ec5a83c919f6563c4c0c9e7bb2bf53bd0adf9235344d914a8d127f2da595a6850fd75b6828a81914241f8964bf004070888fbc77795f0f727cc
 DIST glibc-2.37-patches-11.tar.xz 74472 BLAKE2B 25d17b1720b9ee955d176f3f42315ff386e706291fec3d7fe7910d428b878fca5986906b848755ffe74e7d108ac5aad836f403e40290ebae50a103691cb7ed66 SHA512 d5483fe1506cd1bd094e433177209ce2e8639081618582930538b3064ac1a72886074e4c0f10bf7beca2b871404f3d4c61e8f6aa2ba8c4166acfca65cc7a9af7
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
-DIST glibc-2.38-patches-6.tar.xz 49680 BLAKE2B 2f929aaeebc06164ae6b1fa81ce149beb8467e3928a35f667c2b489c96de346d24020cf017c9e1a6942aa57c177f34637ca5bfe3aee7641702bb6c589b4b6283 SHA512 18d7f6216721c9ca75a3e759e30aa0429c57e296a1223b2a5a5bbdd26edf523a6bf509437d913b9c2b95ca1e41543a904b72a89afa444606d3b3949311341958
 DIST glibc-2.38-patches-7.tar.xz 49276 BLAKE2B ef86c88540018bc7347ee57cc60138f010dd95e749f3c1c4ca196a9a707188851345fa41d00dacf25d7ed424486f75020af430e61b0a9bb74714976156bb35ae SHA512 5bad7ee804a2a0e31517c23f6a5eca82f00a695edccb3af81309ace8b441f1e2be704568660c87e8f4770f8d63cde272875d789c6fcbef61da534f7573851831
 DIST glibc-2.38-patches-9.tar.xz 56716 BLAKE2B 07d814a0715561995495d27164fe40155e4bf424a52e571005669a148cfc23cee136a439c3a8d441b67062f169b4b4f67df76549c922f2c5d87def07de067561 SHA512 a33c65a9fb56fab39a1656e4bf359525d52a26ffcf6648f60a72e94c1b6b569eb25b3c46502f43a7aabfbb6507c9ce24def3ebd7069e23d583a029c91f0984e7
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900

diff --git a/sys-libs/glibc/glibc-2.38-r6.ebuild b/sys-libs/glibc/glibc-2.38-r6.ebuild
deleted file mode 100644
index 0dbe82eee65b..000000000000
--- a/sys-libs/glibc/glibc-2.38-r6.ebuild
+++ /dev/null
@@ -1,1706 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..12} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=6
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	tst-sched1
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# we give the tests a bit more time to avoid spurious
-	# bug reports on slow arches
-
-	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-03 21:54 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-01-03 21:54 UTC (permalink / raw
  To: gentoo-commits

commit:     4569f05afae6d9fea70cb9982c694f1fdca38622
Author:     Eli Schwartz <eschwartz93 <AT> gmail <DOT> com>
AuthorDate: Wed Dec 27 04:14:50 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jan  3 21:54:20 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4569f05a

sys-libs/glibc: disable stripping for ld.so as well

Similar to how pthread must not be stripped in order to avoid breaking
gdb, ld.so must not be stripped in order to avoid breaking valgrind.

Closes: https://bugs.gentoo.org/920753
Signed-off-by: Eli Schwartz <eschwartz93 <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r9.ebuild | 1684 ++++++++++++++++++++++++++++++++++
 sys-libs/glibc/glibc-2.38-r9.ebuild | 1718 +++++++++++++++++++++++++++++++++++
 2 files changed, 3402 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.37-r9.ebuild b/sys-libs/glibc/glibc-2.37-r9.ebuild
new file mode 100644
index 000000000000..31748a86fe4b
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.37-r9.ebuild
@@ -0,0 +1,1684 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..11} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=11
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	tst-sched1
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}

diff --git a/sys-libs/glibc/glibc-2.38-r9.ebuild b/sys-libs/glibc/glibc-2.38-r9.ebuild
new file mode 100644
index 000000000000..2327ebd84994
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.38-r9.ebuild
@@ -0,0 +1,1718 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{9..12} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=9
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-util/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# we give the tests a bit more time to avoid spurious
+	# bug reports on slow arches
+
+	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-03 21:56 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-01-03 21:56 UTC (permalink / raw
  To: gentoo-commits

commit:     553b282b75beaf4c11a3018587bbb9ae613f43f8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  3 21:56:33 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jan  3 21:56:33 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=553b282b

sys-libs/glibc: sync livc

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 72861bd7fa19..ed6513f68aee 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -88,6 +88,8 @@ fi
 #   * normal 'strip' command trims '.symtab'
 #   Thus our main goal here is to prevent 'libpthread.so.0' from
 #   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
 # As Gentoo's strip does not allow us to pass less aggressive stripping
 # options and does not check the machine target we strip selectively.
 
@@ -1348,6 +1350,8 @@ glibc_do_src_install() {
 	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
 	# See Note [Disable automatic stripping]
 	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
 
 	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
 		# Move versioned .a file out of libdir to evade portage QA checks


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-07  9:53 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-01-07  9:53 UTC (permalink / raw
  To: gentoo-commits

commit:     00125d74c6c7eea41a6a304de8220581a1364d8b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  7 09:52:21 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan  7 09:52:21 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=00125d74

sys-libs/glibc: Stabilize 2.37-r9 amd64, #915653

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r9.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.37-r9.ebuild b/sys-libs/glibc/glibc-2.37-r9.ebuild
index 31748a86fe4b..d1257fb8c99f 100644
--- a/sys-libs/glibc/glibc-2.37-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r9.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-07  9:53 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-01-07  9:53 UTC (permalink / raw
  To: gentoo-commits

commit:     5cc2c592bccc07fa95811d1c3eb330f860cd5fb1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  7 09:52:23 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan  7 09:52:23 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5cc2c592

sys-libs/glibc: Stabilize 2.38-r9 amd64, #915653

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r9.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.38-r9.ebuild b/sys-libs/glibc/glibc-2.38-r9.ebuild
index 2327ebd84994..c4b10d967daa 100644
--- a/sys-libs/glibc/glibc-2.38-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r9.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-07 12:42 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-01-07 12:42 UTC (permalink / raw
  To: gentoo-commits

commit:     eb4902bd529ede85aac92987a8b32b31f6c092d0
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  7 12:41:43 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Jan  7 12:41:43 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eb4902bd

sys-libs/glibc: Stabilize 2.38-r9 arm64, #915653

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r9.ebuild b/sys-libs/glibc/glibc-2.38-r9.ebuild
index 5a410b6323f0..2da7d1321ea2 100644
--- a/sys-libs/glibc/glibc-2.38-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r9.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-07 12:42 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-01-07 12:42 UTC (permalink / raw
  To: gentoo-commits

commit:     1de3d78e4148324e33b671d07a248df17bc1e12c
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  7 12:41:41 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Jan  7 12:41:41 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1de3d78e

sys-libs/glibc: Stabilize 2.38-r9 ppc64, #915653

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r9.ebuild b/sys-libs/glibc/glibc-2.38-r9.ebuild
index c4b10d967daa..5a410b6323f0 100644
--- a/sys-libs/glibc/glibc-2.38-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r9.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-07 12:42 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-01-07 12:42 UTC (permalink / raw
  To: gentoo-commits

commit:     008d0ba35b944aae2dd32a000dafbfa65c05b845
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  7 12:41:41 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Jan  7 12:41:41 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=008d0ba3

sys-libs/glibc: Stabilize 2.37-r9 ppc64, #915653

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r9.ebuild b/sys-libs/glibc/glibc-2.37-r9.ebuild
index d1257fb8c99f..718675074022 100644
--- a/sys-libs/glibc/glibc-2.37-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r9.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-07 12:42 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-01-07 12:42 UTC (permalink / raw
  To: gentoo-commits

commit:     1e4902ae1b03c0dbd40ed0abb5b1a8118bd5502c
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  7 12:41:42 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Jan  7 12:41:42 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1e4902ae

sys-libs/glibc: Stabilize 2.37-r9 arm64, #915653

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r9.ebuild b/sys-libs/glibc/glibc-2.37-r9.ebuild
index 718675074022..2b709690cabc 100644
--- a/sys-libs/glibc/glibc-2.37-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r9.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-07 12:43 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-01-07 12:43 UTC (permalink / raw
  To: gentoo-commits

commit:     730d765ef06a99165976794a0ae957d23a7d2f05
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  7 12:42:37 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Jan  7 12:42:37 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=730d765e

sys-libs/glibc: Stabilize 2.37-r9 sparc, #915653

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r9.ebuild b/sys-libs/glibc/glibc-2.37-r9.ebuild
index 50c47cc166a3..771c64b04cb4 100644
--- a/sys-libs/glibc/glibc-2.37-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r9.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-07 12:43 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-01-07 12:43 UTC (permalink / raw
  To: gentoo-commits

commit:     f5e70846130b011e439e133761d48624fa1dedbf
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  7 12:42:42 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Jan  7 12:42:42 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f5e70846

sys-libs/glibc: Stabilize 2.37-r9 ppc, #915653

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r9.ebuild b/sys-libs/glibc/glibc-2.37-r9.ebuild
index 771c64b04cb4..a0e6f3159f60 100644
--- a/sys-libs/glibc/glibc-2.37-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r9.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-07 12:43 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-01-07 12:43 UTC (permalink / raw
  To: gentoo-commits

commit:     dc35592545775d2dbbf24c92c2b1d4389eec8e80
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  7 12:42:42 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Jan  7 12:42:42 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dc355925

sys-libs/glibc: Stabilize 2.38-r9 ppc, #915653

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r9.ebuild b/sys-libs/glibc/glibc-2.38-r9.ebuild
index 753fa2a3e9d8..06c62f8dc1a2 100644
--- a/sys-libs/glibc/glibc-2.38-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r9.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-07 12:43 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-01-07 12:43 UTC (permalink / raw
  To: gentoo-commits

commit:     ff8e575601146354a60f16422d8fe7e7fad90609
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  7 12:42:34 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Jan  7 12:42:34 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ff8e5756

sys-libs/glibc: Stabilize 2.38-r9 arm, #915653

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r9.ebuild b/sys-libs/glibc/glibc-2.38-r9.ebuild
index 2da7d1321ea2..a0c36e5412bf 100644
--- a/sys-libs/glibc/glibc-2.38-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r9.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-07 12:43 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-01-07 12:43 UTC (permalink / raw
  To: gentoo-commits

commit:     7088e4db7b9b1307c7870f95e847bccf0c49efdb
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  7 12:42:33 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Jan  7 12:42:33 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7088e4db

sys-libs/glibc: Stabilize 2.37-r9 arm, #915653

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r9.ebuild b/sys-libs/glibc/glibc-2.37-r9.ebuild
index 2b709690cabc..50c47cc166a3 100644
--- a/sys-libs/glibc/glibc-2.37-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r9.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-07 12:43 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-01-07 12:43 UTC (permalink / raw
  To: gentoo-commits

commit:     f128f4e2f97ddf5d2cf5cfbc93b26b4ea4269158
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  7 12:42:38 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Jan  7 12:42:38 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f128f4e2

sys-libs/glibc: Stabilize 2.38-r9 sparc, #915653

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r9.ebuild b/sys-libs/glibc/glibc-2.38-r9.ebuild
index a0c36e5412bf..753fa2a3e9d8 100644
--- a/sys-libs/glibc/glibc-2.38-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r9.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-07 14:25 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-01-07 14:25 UTC (permalink / raw
  To: gentoo-commits

commit:     20aca4d98b6e96f0bbce041dcc5c394954f1ca70
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  7 14:25:07 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Jan  7 14:25:07 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=20aca4d9

sys-libs/glibc: Stabilize 2.38-r9 x86, #915653

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r9.ebuild b/sys-libs/glibc/glibc-2.38-r9.ebuild
index 06c62f8dc1a2..d628008d5a2c 100644
--- a/sys-libs/glibc/glibc-2.38-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r9.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-07 14:25 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-01-07 14:25 UTC (permalink / raw
  To: gentoo-commits

commit:     f1b171c7f153955ecb7baeaa6ec721a10a51390c
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  7 14:25:07 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Jan  7 14:25:07 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f1b171c7

sys-libs/glibc: Stabilize 2.37-r9 x86, #915653

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r9.ebuild b/sys-libs/glibc/glibc-2.37-r9.ebuild
index a0e6f3159f60..ed9929cfbd83 100644
--- a/sys-libs/glibc/glibc-2.37-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r9.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-09  2:57 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-01-09  2:57 UTC (permalink / raw
  To: gentoo-commits

commit:     5e8edd182bbdde8d8df9743ef5ed2a847a3d7013
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  9 02:56:35 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jan  9 02:56:35 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5e8edd18

sys-libs/glibc: add -ia64 to glibc-9999 in preparation for glibc-2.39

ia64 support was removed upstream.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index ed6513f68aee..a1efdfa51e2c 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-09 15:21 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-01-09 15:21 UTC (permalink / raw
  To: gentoo-commits

commit:     04c21a994d3b78fd1830435ce92f60f784dea552
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  9 15:19:37 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jan  9 15:21:25 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04c21a99

sys-libs/glibc: Drop ia64 in 9999

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a1efdfa51e2c..4740163cf11f 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1082,16 +1082,6 @@ glibc_do_configure() {
 	echo "$@"
 	"$@" || die "failed to configure glibc"
 
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
 	# If we're trying to migrate between ABI sets, we need
 	# to lie and use a local copy of gcc.  Like if the system
 	# is built with MULTILIB_ABIS="amd64 x86" but we want to
@@ -1117,7 +1107,7 @@ glibc_headers_configure() {
 	# the best here ...
 	local v vars=(
 		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
 		libc_cv_asm_cfi_directives=yes
 		libc_cv_broken_visibility_attribute=no
 		libc_cv_c_cleanup=yes


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-11  0:05 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-01-11  0:05 UTC (permalink / raw
  To: gentoo-commits

commit:     a18e305b7c60c9be32e95a58de4797c1c06c35cf
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 11 00:05:11 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Jan 11 00:05:29 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a18e305b

sys-libs/glibc: drop 2.37-r8, 2.38-r7, 2.38-r8

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.37-r8.ebuild | 1680 ----------------------------------
 sys-libs/glibc/glibc-2.38-r7.ebuild | 1713 ----------------------------------
 sys-libs/glibc/glibc-2.38-r8.ebuild | 1714 -----------------------------------
 4 files changed, 5108 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 88dd83cffd65..46395a92c7cc 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,7 +20,6 @@ DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a59
 DIST glibc-2.37-patches-10.tar.xz 72768 BLAKE2B 20501519a570a5d277a3c1460373edea4131602b07037a81d855f1dcbc5b8d40fa6edae500a9f30e9541389dc1b4a7406cbee8e8a85a3131932e23f807e1b211 SHA512 f1e3791befa98ec5a83c919f6563c4c0c9e7bb2bf53bd0adf9235344d914a8d127f2da595a6850fd75b6828a81914241f8964bf004070888fbc77795f0f727cc
 DIST glibc-2.37-patches-11.tar.xz 74472 BLAKE2B 25d17b1720b9ee955d176f3f42315ff386e706291fec3d7fe7910d428b878fca5986906b848755ffe74e7d108ac5aad836f403e40290ebae50a103691cb7ed66 SHA512 d5483fe1506cd1bd094e433177209ce2e8639081618582930538b3064ac1a72886074e4c0f10bf7beca2b871404f3d4c61e8f6aa2ba8c4166acfca65cc7a9af7
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
-DIST glibc-2.38-patches-7.tar.xz 49276 BLAKE2B ef86c88540018bc7347ee57cc60138f010dd95e749f3c1c4ca196a9a707188851345fa41d00dacf25d7ed424486f75020af430e61b0a9bb74714976156bb35ae SHA512 5bad7ee804a2a0e31517c23f6a5eca82f00a695edccb3af81309ace8b441f1e2be704568660c87e8f4770f8d63cde272875d789c6fcbef61da534f7573851831
 DIST glibc-2.38-patches-9.tar.xz 56716 BLAKE2B 07d814a0715561995495d27164fe40155e4bf424a52e571005669a148cfc23cee136a439c3a8d441b67062f169b4b4f67df76549c922f2c5d87def07de067561 SHA512 a33c65a9fb56fab39a1656e4bf359525d52a26ffcf6648f60a72e94c1b6b569eb25b3c46502f43a7aabfbb6507c9ce24def3ebd7069e23d583a029c91f0984e7
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238

diff --git a/sys-libs/glibc/glibc-2.37-r8.ebuild b/sys-libs/glibc/glibc-2.37-r8.ebuild
deleted file mode 100644
index b267d37bcf49..000000000000
--- a/sys-libs/glibc/glibc-2.37-r8.ebuild
+++ /dev/null
@@ -1,1680 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..11} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=11
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	tst-sched1
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.38-r7.ebuild b/sys-libs/glibc/glibc-2.38-r7.ebuild
deleted file mode 100644
index 6805f991b469..000000000000
--- a/sys-libs/glibc/glibc-2.38-r7.ebuild
+++ /dev/null
@@ -1,1713 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..12} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=7
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	tst-sched1
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# we give the tests a bit more time to avoid spurious
-	# bug reports on slow arches
-
-	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.38-r8.ebuild b/sys-libs/glibc/glibc-2.38-r8.ebuild
deleted file mode 100644
index e9a58b8e1293..000000000000
--- a/sys-libs/glibc/glibc-2.38-r8.ebuild
+++ /dev/null
@@ -1,1714 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{9..12} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=9
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-util/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
-	tst-sched1
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# we give the tests a bit more time to avoid spurious
-	# bug reports on slow arches
-
-	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-11 18:55 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-01-11 18:55 UTC (permalink / raw
  To: gentoo-commits

commit:     440c4aa22168442d23c67876567d97220e849dec
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 11 18:55:24 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Jan 11 18:55:48 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=440c4aa2

sys-libs/glibc: libcrypt has been removed from the GNU C Library

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 4740163cf11f..cd4b039899b3 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -47,7 +47,7 @@ fi
 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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
 
 # Here's how the cross-compile logic breaks down ...
 #  CTARGET - machine that will target the binaries
@@ -1038,7 +1038,6 @@ glibc_do_configure() {
 		--libexecdir='$(libdir)'/misc/glibc
 		--with-bugurl=https://bugs.gentoo.org/
 		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
 		$(use_multiarch || echo --disable-multi-arch)
 		$(use_enable systemtap)
 		$(use_enable nscd)
@@ -1194,7 +1193,6 @@ glibc_headers_configure() {
 		--host=${CTARGET_OPT:-${CTARGET}}
 		--with-headers=$(build_eprefix)$(alt_build_headers)
 		--prefix="$(host_eprefix)/usr"
-		$(use_enable crypt)
 		${EXTRA_ECONF}
 	)
 
@@ -1632,7 +1630,7 @@ pkg_preinst() {
 	# 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
+	if 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


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-23 18:13 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-01-23 18:13 UTC (permalink / raw
  To: gentoo-commits

commit:     cd6541a56cd79a25033051cbc709fefdf6eeba05
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 23 18:12:47 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jan 23 18:13:14 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cd6541a5

sys-libs/glibc: add always-on crypt useflag in 2.19

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/{glibc-2.19-r2.ebuild => glibc-2.19-r3.ebuild} | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.19-r2.ebuild b/sys-libs/glibc/glibc-2.19-r3.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.19-r2.ebuild
rename to sys-libs/glibc/glibc-2.19-r3.ebuild
index a7114330c4ad..692c93b9e4cd 100644
--- a/sys-libs/glibc/glibc-2.19-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r3.ebuild
@@ -33,7 +33,11 @@ PATCH_VER=9
 SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
 SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
 
-IUSE="audit caps compile-locales debug doc gd headers-only multilib nscd profile selinux suid systemtap vanilla"
+IUSE="audit caps compile-locales +crypt debug doc gd headers-only multilib nscd profile selinux suid systemtap vanilla"
+
+# Yes this is a hack. It's always on here and we want to be able
+# to simplify the dependencies...
+REQUIRED_USE="crypt"
 
 # Minimum kernel version that glibc requires
 # hppa requires 2.6.20


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-23 18:28 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-01-23 18:28 UTC (permalink / raw
  To: gentoo-commits

commit:     405717c399780ed22d07eab938ed1f9634614b6d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 23 18:28:05 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jan 23 18:28:35 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=405717c3

sys-libs/glibc: XFAIL valgrind-based test

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 18d7a9e001b4..108a4dfa2070 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -170,8 +170,12 @@ XFAIL_TEST_LIST=(
 	tst-system
 	tst-strerror
 	tst-strsignal
+
 	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
 	tst-sched1
+
+	# Fails regularly, unreliable
+	tst-valgrind-smoke
 )
 
 XFAIL_NSPAWN_TEST_LIST=(


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-30 19:16 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-01-30 19:16 UTC (permalink / raw
  To: gentoo-commits

commit:     3e7a0255894955fd1cb38809c95e33b3e70f1d43
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 30 19:15:24 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jan 30 19:15:56 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3e7a0255

sys-libs/glibc: Add 2.38 patchlevel 10 (no keywords)

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    1 +
 sys-libs/glibc/glibc-2.38-r10.ebuild | 1718 ++++++++++++++++++++++++++++++++++
 2 files changed, 1719 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 46395a92c7cc..a79b727bae14 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,6 +20,7 @@ DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a59
 DIST glibc-2.37-patches-10.tar.xz 72768 BLAKE2B 20501519a570a5d277a3c1460373edea4131602b07037a81d855f1dcbc5b8d40fa6edae500a9f30e9541389dc1b4a7406cbee8e8a85a3131932e23f807e1b211 SHA512 f1e3791befa98ec5a83c919f6563c4c0c9e7bb2bf53bd0adf9235344d914a8d127f2da595a6850fd75b6828a81914241f8964bf004070888fbc77795f0f727cc
 DIST glibc-2.37-patches-11.tar.xz 74472 BLAKE2B 25d17b1720b9ee955d176f3f42315ff386e706291fec3d7fe7910d428b878fca5986906b848755ffe74e7d108ac5aad836f403e40290ebae50a103691cb7ed66 SHA512 d5483fe1506cd1bd094e433177209ce2e8639081618582930538b3064ac1a72886074e4c0f10bf7beca2b871404f3d4c61e8f6aa2ba8c4166acfca65cc7a9af7
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
+DIST glibc-2.38-patches-10.tar.xz 60792 BLAKE2B e228568f9e9cfa719ee9f2f91d220efa53e4eba617377fdf37bf7381b9f7c43036dfe62dd284b4228e9a99d41223ed0416ed058407a630b84064962518cba90b SHA512 573661299d75b63b7e2f771e9032193492e762e64cbb495b42bb7ad1021532f54f19d829a721e8070c79b2ad5edef077584cc4c76896d951cc93275592cf255c
 DIST glibc-2.38-patches-9.tar.xz 56716 BLAKE2B 07d814a0715561995495d27164fe40155e4bf424a52e571005669a148cfc23cee136a439c3a8d441b67062f169b4b4f67df76549c922f2c5d87def07de067561 SHA512 a33c65a9fb56fab39a1656e4bf359525d52a26ffcf6648f60a72e94c1b6b569eb25b3c46502f43a7aabfbb6507c9ce24def3ebd7069e23d583a029c91f0984e7
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238

diff --git a/sys-libs/glibc/glibc-2.38-r10.ebuild b/sys-libs/glibc/glibc-2.38-r10.ebuild
new file mode 100644
index 000000000000..1108e95e6c8c
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.38-r10.ebuild
@@ -0,0 +1,1718 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=10
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# we give the tests a bit more time to avoid spurious
+	# bug reports on slow arches
+
+	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-31  1:36 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-01-31  1:36 UTC (permalink / raw
  To: gentoo-commits

commit:     e4d5c61772ca806cff2ec2f90a6a48fad376810b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 31 01:35:33 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jan 31 01:36:12 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4d5c617

sys-libs/glibc: keyword 2.38-r10

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r10.ebuild b/sys-libs/glibc/glibc-2.38-r10.ebuild
index 1108e95e6c8c..6cc5c346ff17 100644
--- a/sys-libs/glibc/glibc-2.38-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r10.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-31 16:35 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-01-31 16:35 UTC (permalink / raw
  To: gentoo-commits

commit:     9bedbe322677395aff824d88d6a56c13c81eab43
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 31 16:34:47 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jan 31 16:34:47 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9bedbe32

sys-libs/glibc: add 2.37-r10 (patchl. 12), COMPLETELY UNTESTED, no keywords

Need to find a leftover 2.37 chroot...

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    1 +
 sys-libs/glibc/glibc-2.37-r10.ebuild | 1684 ++++++++++++++++++++++++++++++++++
 2 files changed, 1685 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index a79b727bae14..dea8a90fa275 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,6 +19,7 @@ DIST glibc-2.36-patches-10.tar.xz 118268 BLAKE2B 3d1bdb6c1a9e10ba78a344ca8940f68
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-2.37-patches-10.tar.xz 72768 BLAKE2B 20501519a570a5d277a3c1460373edea4131602b07037a81d855f1dcbc5b8d40fa6edae500a9f30e9541389dc1b4a7406cbee8e8a85a3131932e23f807e1b211 SHA512 f1e3791befa98ec5a83c919f6563c4c0c9e7bb2bf53bd0adf9235344d914a8d127f2da595a6850fd75b6828a81914241f8964bf004070888fbc77795f0f727cc
 DIST glibc-2.37-patches-11.tar.xz 74472 BLAKE2B 25d17b1720b9ee955d176f3f42315ff386e706291fec3d7fe7910d428b878fca5986906b848755ffe74e7d108ac5aad836f403e40290ebae50a103691cb7ed66 SHA512 d5483fe1506cd1bd094e433177209ce2e8639081618582930538b3064ac1a72886074e4c0f10bf7beca2b871404f3d4c61e8f6aa2ba8c4166acfca65cc7a9af7
+DIST glibc-2.37-patches-12.tar.xz 83716 BLAKE2B 123951d94dad6c22150c4ef2299bcaafc080322d6eeb58b49b0525a7f5c6867e99e96cd5c065578632d9a73b5527e2b2742bc29162da487894ecea6aff75df2e SHA512 b53c06e157b23f5fae1cd15eb90fdbf3076c79f295a687bdfd285689f94417267f167ff2d6a55c4d3c3b2e08dd6406c36fed4a5fee33378dd69976c1102c01a2
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-10.tar.xz 60792 BLAKE2B e228568f9e9cfa719ee9f2f91d220efa53e4eba617377fdf37bf7381b9f7c43036dfe62dd284b4228e9a99d41223ed0416ed058407a630b84064962518cba90b SHA512 573661299d75b63b7e2f771e9032193492e762e64cbb495b42bb7ad1021532f54f19d829a721e8070c79b2ad5edef077584cc4c76896d951cc93275592cf255c
 DIST glibc-2.38-patches-9.tar.xz 56716 BLAKE2B 07d814a0715561995495d27164fe40155e4bf424a52e571005669a148cfc23cee136a439c3a8d441b67062f169b4b4f67df76549c922f2c5d87def07de067561 SHA512 a33c65a9fb56fab39a1656e4bf359525d52a26ffcf6648f60a72e94c1b6b569eb25b3c46502f43a7aabfbb6507c9ce24def3ebd7069e23d583a029c91f0984e7

diff --git a/sys-libs/glibc/glibc-2.37-r10.ebuild b/sys-libs/glibc/glibc-2.37-r10.ebuild
new file mode 100644
index 000000000000..abec2443a898
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.37-r10.ebuild
@@ -0,0 +1,1684 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..11} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=12
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	tst-sched1
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# -march= option tricks build system to infer too
+		# high ISA level: https://sourceware.org/PR27318
+		libc_cv_include_x86_isa_level=no
+
+		# Explicit override of https://sourceware.org/PR27991
+		# exposes a bug in glibc's configure:
+		# https://sourceware.org/PR27991
+		libc_cv_have_x86_lahf_sahf=no
+		libc_cv_have_x86_movbe=no
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'main(){}' > "${T}"/test.c
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	case ${CTARGET} in
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	local myconf=()
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-31 22:02 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-01-31 22:02 UTC (permalink / raw
  To: gentoo-commits

commit:     ac78a6d2a0ec2546a59ed98e00499ddd8343b13d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 31 22:02:03 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jan 31 22:02:24 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ac78a6d2

sys-libs/glibc: keyword 2.37-r10

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r10.ebuild b/sys-libs/glibc/glibc-2.37-r10.ebuild
index abec2443a898..a14da8675891 100644
--- a/sys-libs/glibc/glibc-2.37-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r10.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-31 22:05 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-01-31 22:05 UTC (permalink / raw
  To: gentoo-commits

commit:     c3f452c8fa8028ed4f2c9805fb0e449b9dabde77
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 31 22:05:20 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jan 31 22:05:20 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c3f452c8

sys-libs/glibc: Stabilize 2.38-r10 ppc, #923432

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r10.ebuild b/sys-libs/glibc/glibc-2.38-r10.ebuild
index 6cc5c346ff17..33af0804ad1f 100644
--- a/sys-libs/glibc/glibc-2.38-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r10.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-31 22:05 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-01-31 22:05 UTC (permalink / raw
  To: gentoo-commits

commit:     2bf703463400110015e97b96ac531c8ef01a5651
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 31 22:05:21 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jan 31 22:05:21 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2bf70346

sys-libs/glibc: Stabilize 2.38-r10 ppc64, #923432

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r10.ebuild b/sys-libs/glibc/glibc-2.38-r10.ebuild
index 33af0804ad1f..fa1cf363ac1e 100644
--- a/sys-libs/glibc/glibc-2.38-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r10.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-31 22:08 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-01-31 22:08 UTC (permalink / raw
  To: gentoo-commits

commit:     ee9610d2cf9d137f860df56345b5f17ab077bff9
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 31 22:07:56 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jan 31 22:07:56 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee9610d2

sys-libs/glibc: Stabilize 2.38-r10 amd64, #923432

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r10.ebuild b/sys-libs/glibc/glibc-2.38-r10.ebuild
index fa1cf363ac1e..c58d6e489202 100644
--- a/sys-libs/glibc/glibc-2.38-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r10.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-01-31 23:23 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-01-31 23:23 UTC (permalink / raw
  To: gentoo-commits

commit:     d6d8d0c04f0bc8264709f27f9fc6576da11d6ded
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 31 23:23:05 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jan 31 23:23:32 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d6d8d0c0

sys-libs/glibc: add 2.39

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          |    2 +
 sys-libs/glibc/glibc-2.39.ebuild | 1710 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 1712 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index dea8a90fa275..31cf34514863 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -24,6 +24,8 @@ DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb8
 DIST glibc-2.38-patches-10.tar.xz 60792 BLAKE2B e228568f9e9cfa719ee9f2f91d220efa53e4eba617377fdf37bf7381b9f7c43036dfe62dd284b4228e9a99d41223ed0416ed058407a630b84064962518cba90b SHA512 573661299d75b63b7e2f771e9032193492e762e64cbb495b42bb7ad1021532f54f19d829a721e8070c79b2ad5edef077584cc4c76896d951cc93275592cf255c
 DIST glibc-2.38-patches-9.tar.xz 56716 BLAKE2B 07d814a0715561995495d27164fe40155e4bf424a52e571005669a148cfc23cee136a439c3a8d441b67062f169b4b4f67df76549c922f2c5d87def07de067561 SHA512 a33c65a9fb56fab39a1656e4bf359525d52a26ffcf6648f60a72e94c1b6b569eb25b3c46502f43a7aabfbb6507c9ce24def3ebd7069e23d583a029c91f0984e7
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
+DIST glibc-2.39-patches-1.tar.xz 14316 BLAKE2B e0a05eb98d11ed4bc332b9267bc363ed8d7cfed8e9a1e7d1e854802830326241b231fc6fcca4f97bf80e52c361863f21fe09e060febe3234e1f6dd9e6cfa78f8 SHA512 0391ed526fc5686fd6e3a01beb18d92702ad7b5f8ad06651f1a1be174b16d7ab367cf3375b98e9c54b9dffee2e3416b22d60963dcf3a96e0d6141b682943ccd2
+DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff

diff --git a/sys-libs/glibc/glibc-2.39.ebuild b/sys-libs/glibc/glibc-2.39.ebuild
new file mode 100644
index 000000000000..108a4dfa2070
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.39.ebuild
@@ -0,0 +1,1710 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=1
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+
+	# Fails regularly, unreliable
+	tst-valgrind-smoke
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-02-02  2:34 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-02-02  2:34 UTC (permalink / raw
  To: gentoo-commits

commit:     33986da0bb8e6a084679c0d9422f97352492cca3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  2 02:33:01 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb  2 02:33:01 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=33986da0

sys-libs/glibc: Stabilize 2.38-r10 arm, #923432

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r10.ebuild b/sys-libs/glibc/glibc-2.38-r10.ebuild
index 82d16e88c5d9..35eb86bc2be9 100644
--- a/sys-libs/glibc/glibc-2.38-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r10.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-02-02  2:34 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-02-02  2:34 UTC (permalink / raw
  To: gentoo-commits

commit:     5e2ca2699ada1cdd4234a6a19cad02bef9c61564
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  2 02:32:55 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb  2 02:32:55 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5e2ca269

sys-libs/glibc: Stabilize 2.38-r10 arm64, #923432

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r10.ebuild b/sys-libs/glibc/glibc-2.38-r10.ebuild
index c58d6e489202..82d16e88c5d9 100644
--- a/sys-libs/glibc/glibc-2.38-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r10.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-02-02  2:34 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-02-02  2:34 UTC (permalink / raw
  To: gentoo-commits

commit:     79f940bb028478208996a4a5ae7473ec28ab6a02
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  2 02:33:06 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb  2 02:33:06 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=79f940bb

sys-libs/glibc: Stabilize 2.38-r10 hppa, #923432

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r10.ebuild b/sys-libs/glibc/glibc-2.38-r10.ebuild
index 35eb86bc2be9..15df9948c3e6 100644
--- a/sys-libs/glibc/glibc-2.38-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r10.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-02-02  2:34 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-02-02  2:34 UTC (permalink / raw
  To: gentoo-commits

commit:     3af2c8539725cc779358f206b43e83ca8d25545e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  2 02:33:19 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb  2 02:33:19 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3af2c853

sys-libs/glibc: Stabilize 2.38-r10 sparc, #923432

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r10.ebuild b/sys-libs/glibc/glibc-2.38-r10.ebuild
index 15df9948c3e6..926151222dd5 100644
--- a/sys-libs/glibc/glibc-2.38-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r10.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-02-02  2:34 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-02-02  2:34 UTC (permalink / raw
  To: gentoo-commits

commit:     e309c8e13c4b1ff5eabb8a52f04dfe12e97e3754
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  2 02:33:25 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb  2 02:33:25 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e309c8e1

sys-libs/glibc: Stabilize 2.38-r10 x86, #923432

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r10.ebuild b/sys-libs/glibc/glibc-2.38-r10.ebuild
index 926151222dd5..5fca93e98070 100644
--- a/sys-libs/glibc/glibc-2.38-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r10.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-02-05 23:09 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-02-05 23:09 UTC (permalink / raw
  To: gentoo-commits

commit:     39591541801af0a424b2d9d30bf6c25710ab07b7
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  5 22:42:24 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Feb  5 22:42:24 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=39591541

sys-libs/glibc: stabilize 2.37-r10

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.37-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.37-r10.ebuild b/sys-libs/glibc/glibc-2.37-r10.ebuild
index a14da8675891..053cfe2b0f85 100644
--- a/sys-libs/glibc/glibc-2.37-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r10.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-02-05 23:09 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-02-05 23:09 UTC (permalink / raw
  To: gentoo-commits

commit:     849db3ce033ee1b6c7e818cbf88fa8a1149af68e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  5 22:44:33 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Feb  5 22:44:33 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=849db3ce

sys-libs/glibc: drop 2.37-r7, 2.37-r9, 2.38-r9

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    3 -
 sys-libs/glibc/glibc-2.37-r7.ebuild | 1680 ----------------------------------
 sys-libs/glibc/glibc-2.37-r9.ebuild | 1684 ----------------------------------
 sys-libs/glibc/glibc-2.38-r9.ebuild | 1718 -----------------------------------
 4 files changed, 5085 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 31cf34514863..f49b62073d6a 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -17,12 +17,9 @@ DIST glibc-2.35-patches-12.tar.xz 266056 BLAKE2B 7979dcfee270107d51c10e5ec74c9c1
 DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66
 DIST glibc-2.36-patches-10.tar.xz 118268 BLAKE2B 3d1bdb6c1a9e10ba78a344ca8940f68c49411a94aefd4d66bab17d784bc8783f2ae71efb171dea6d1919ea2c4a1f54333dabc2c4d99838ba8ec568484b84d0ae SHA512 b88dfc56ffc2df495e13cf90e709629db2b9b411a1c5ba6d39f40f45be3c2f49df7b1fe320d1cd7552515fe68dfc644c12916a6db34139ccf94ff755235d3a40
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
-DIST glibc-2.37-patches-10.tar.xz 72768 BLAKE2B 20501519a570a5d277a3c1460373edea4131602b07037a81d855f1dcbc5b8d40fa6edae500a9f30e9541389dc1b4a7406cbee8e8a85a3131932e23f807e1b211 SHA512 f1e3791befa98ec5a83c919f6563c4c0c9e7bb2bf53bd0adf9235344d914a8d127f2da595a6850fd75b6828a81914241f8964bf004070888fbc77795f0f727cc
-DIST glibc-2.37-patches-11.tar.xz 74472 BLAKE2B 25d17b1720b9ee955d176f3f42315ff386e706291fec3d7fe7910d428b878fca5986906b848755ffe74e7d108ac5aad836f403e40290ebae50a103691cb7ed66 SHA512 d5483fe1506cd1bd094e433177209ce2e8639081618582930538b3064ac1a72886074e4c0f10bf7beca2b871404f3d4c61e8f6aa2ba8c4166acfca65cc7a9af7
 DIST glibc-2.37-patches-12.tar.xz 83716 BLAKE2B 123951d94dad6c22150c4ef2299bcaafc080322d6eeb58b49b0525a7f5c6867e99e96cd5c065578632d9a73b5527e2b2742bc29162da487894ecea6aff75df2e SHA512 b53c06e157b23f5fae1cd15eb90fdbf3076c79f295a687bdfd285689f94417267f167ff2d6a55c4d3c3b2e08dd6406c36fed4a5fee33378dd69976c1102c01a2
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-10.tar.xz 60792 BLAKE2B e228568f9e9cfa719ee9f2f91d220efa53e4eba617377fdf37bf7381b9f7c43036dfe62dd284b4228e9a99d41223ed0416ed058407a630b84064962518cba90b SHA512 573661299d75b63b7e2f771e9032193492e762e64cbb495b42bb7ad1021532f54f19d829a721e8070c79b2ad5edef077584cc4c76896d951cc93275592cf255c
-DIST glibc-2.38-patches-9.tar.xz 56716 BLAKE2B 07d814a0715561995495d27164fe40155e4bf424a52e571005669a148cfc23cee136a439c3a8d441b67062f169b4b4f67df76549c922f2c5d87def07de067561 SHA512 a33c65a9fb56fab39a1656e4bf359525d52a26ffcf6648f60a72e94c1b6b569eb25b3c46502f43a7aabfbb6507c9ce24def3ebd7069e23d583a029c91f0984e7
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-2.39-patches-1.tar.xz 14316 BLAKE2B e0a05eb98d11ed4bc332b9267bc363ed8d7cfed8e9a1e7d1e854802830326241b231fc6fcca4f97bf80e52c361863f21fe09e060febe3234e1f6dd9e6cfa78f8 SHA512 0391ed526fc5686fd6e3a01beb18d92702ad7b5f8ad06651f1a1be174b16d7ab367cf3375b98e9c54b9dffee2e3416b22d60963dcf3a96e0d6141b682943ccd2
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2

diff --git a/sys-libs/glibc/glibc-2.37-r7.ebuild b/sys-libs/glibc/glibc-2.37-r7.ebuild
deleted file mode 100644
index 8e631b112b74..000000000000
--- a/sys-libs/glibc/glibc-2.37-r7.ebuild
+++ /dev/null
@@ -1,1680 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..11} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=10
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	tst-sched1
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.37-r9.ebuild b/sys-libs/glibc/glibc-2.37-r9.ebuild
deleted file mode 100644
index 5b38867b4515..000000000000
--- a/sys-libs/glibc/glibc-2.37-r9.ebuild
+++ /dev/null
@@ -1,1684 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..11} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=11
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# - similarly, valgrind requires knowledge about symbols in ld.so:
-#	bug #920753
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	tst-sched1
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# -march= option tricks build system to infer too
-		# high ISA level: https://sourceware.org/PR27318
-		libc_cv_include_x86_isa_level=no
-
-		# Explicit override of https://sourceware.org/PR27991
-		# exposes a bug in glibc's configure:
-		# https://sourceware.org/PR27991
-		libc_cv_have_x86_lahf_sahf=no
-		libc_cv_have_x86_movbe=no
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	case ${CTARGET} in
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	local myconf=()
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	# valgrind requires knowledge about ld.so symbols.
-	dostrip -x $(alt_libdir)/ld-*.so*
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.38-r9.ebuild b/sys-libs/glibc/glibc-2.38-r9.ebuild
deleted file mode 100644
index 8e4b4d3021df..000000000000
--- a/sys-libs/glibc/glibc-2.38-r9.ebuild
+++ /dev/null
@@ -1,1718 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..12} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=9
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# - similarly, valgrind requires knowledge about symbols in ld.so:
-#	bug #920753
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
-	tst-sched1
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# we give the tests a bit more time to avoid spurious
-	# bug reports on slow arches
-
-	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	# valgrind requires knowledge about ld.so symbols.
-	dostrip -x $(alt_libdir)/ld-*.so*
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-02-19  5:44 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-02-19  5:44 UTC (permalink / raw
  To: gentoo-commits

commit:     5c7060eb616d5556e7a1cd8dd413eb42d928059c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 19 05:43:37 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Feb 19 05:44:47 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5c7060eb

sys-libs/glibc: add 2.38 patchlevel 11 (no keywords)

Summary of test results:
   5138 PASS
     86 UNSUPPORTED
     19 XFAIL
      6 XPASS

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    1 +
 sys-libs/glibc/glibc-2.38-r11.ebuild | 1718 ++++++++++++++++++++++++++++++++++
 2 files changed, 1719 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index f49b62073d6a..b18163e4ea57 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,6 +20,7 @@ DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a59
 DIST glibc-2.37-patches-12.tar.xz 83716 BLAKE2B 123951d94dad6c22150c4ef2299bcaafc080322d6eeb58b49b0525a7f5c6867e99e96cd5c065578632d9a73b5527e2b2742bc29162da487894ecea6aff75df2e SHA512 b53c06e157b23f5fae1cd15eb90fdbf3076c79f295a687bdfd285689f94417267f167ff2d6a55c4d3c3b2e08dd6406c36fed4a5fee33378dd69976c1102c01a2
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-10.tar.xz 60792 BLAKE2B e228568f9e9cfa719ee9f2f91d220efa53e4eba617377fdf37bf7381b9f7c43036dfe62dd284b4228e9a99d41223ed0416ed058407a630b84064962518cba90b SHA512 573661299d75b63b7e2f771e9032193492e762e64cbb495b42bb7ad1021532f54f19d829a721e8070c79b2ad5edef077584cc4c76896d951cc93275592cf255c
+DIST glibc-2.38-patches-11.tar.xz 67188 BLAKE2B 5025fd72359842a357e7c2cd76de3e717c9bd117259dd8be93aa6fcd906f8b65e266388bf685e611bfa439d57c03e0a4f7d024d7a766ff275277936f76f1ecbf SHA512 d0fa1c11c153c7ada8668d865a15c7c47013956b5fa1e0d0e2b7e24cea5d3e16909dc8f9ba9b2b392d85271ed71603deb440ead19de50fd61b53a6c1f73d467b
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-2.39-patches-1.tar.xz 14316 BLAKE2B e0a05eb98d11ed4bc332b9267bc363ed8d7cfed8e9a1e7d1e854802830326241b231fc6fcca4f97bf80e52c361863f21fe09e060febe3234e1f6dd9e6cfa78f8 SHA512 0391ed526fc5686fd6e3a01beb18d92702ad7b5f8ad06651f1a1be174b16d7ab367cf3375b98e9c54b9dffee2e3416b22d60963dcf3a96e0d6141b682943ccd2
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2

diff --git a/sys-libs/glibc/glibc-2.38-r11.ebuild b/sys-libs/glibc/glibc-2.38-r11.ebuild
new file mode 100644
index 000000000000..7c14cae8fcab
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.38-r11.ebuild
@@ -0,0 +1,1718 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=11
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# we give the tests a bit more time to avoid spurious
+	# bug reports on slow arches
+
+	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-02-19 16:59 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-02-19 16:59 UTC (permalink / raw
  To: gentoo-commits

commit:     d340f4f8730f5cc190119b6077a032443722d3da
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 19 16:58:53 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Feb 19 16:58:53 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d340f4f8

sys-libs/glibc: keyword 2.38-r11

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r11.ebuild b/sys-libs/glibc/glibc-2.38-r11.ebuild
index 7c14cae8fcab..efa9537fe355 100644
--- a/sys-libs/glibc/glibc-2.38-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r11.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-02-23  7:14 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-02-23  7:14 UTC (permalink / raw
  To: gentoo-commits

commit:     21a25eb278b04b204b043bc23750eec632e3bef0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 23 07:11:07 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb 23 07:13:47 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=21a25eb2

sys-libs/glibc: disable CET for x86

CET is (now) only supported on amd64 and x32. See a0cfc48e8a67506e3f0b2d3ea5e04b45408b3683
in glibc.

While we're here, wire it up for x32.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39.ebuild | 5 ++---
 sys-libs/glibc/glibc-9999.ebuild | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.39.ebuild b/sys-libs/glibc/glibc-2.39.ebuild
index 108a4dfa2070..d48d26dff251 100644
--- a/sys-libs/glibc/glibc-2.39.ebuild
+++ b/sys-libs/glibc/glibc-2.39.ebuild
@@ -988,9 +988,8 @@ glibc_do_configure() {
 		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
 	esac
 
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+	case ${ABI}-${CTARGET} in
+		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
 		*) ;;
 	esac
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 108a4dfa2070..d48d26dff251 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -988,9 +988,8 @@ glibc_do_configure() {
 		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
 	esac
 
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+	case ${ABI}-${CTARGET} in
+		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
 		*) ;;
 	esac
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-02-23 12:13 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-02-23 12:13 UTC (permalink / raw
  To: gentoo-commits

commit:     4c7d5db2b89e5c6891056ffbd7523bc0c37845ba
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 23 12:12:28 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Feb 23 12:13:12 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4c7d5db2

sys-libs/glibc: rekeyword 2.39

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/{glibc-2.39.ebuild => glibc-2.39-r1.ebuild} | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39.ebuild b/sys-libs/glibc/glibc-2.39-r1.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.39.ebuild
rename to sys-libs/glibc/glibc-2.39-r1.ebuild
index d48d26dff251..54ddcc4bbadb 100644
--- a/sys-libs/glibc/glibc-2.39.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r1.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-02-23 23:07 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-02-23 23:07 UTC (permalink / raw
  To: gentoo-commits

commit:     03979888c36ce4e953dcb4faf953522323a352bc
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 23 23:06:28 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Feb 23 23:06:28 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03979888

sys-libs/glibc: Add blocker for too old systemd (otherwise things in nspawns fail)

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r1.ebuild | 5 +++++
 sys-libs/glibc/glibc-9999.ebuild    | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.39-r1.ebuild b/sys-libs/glibc/glibc-2.39-r1.ebuild
index 54ddcc4bbadb..cb9a3aab0ec1 100644
--- a/sys-libs/glibc/glibc-2.39-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r1.ebuild
@@ -36,6 +36,10 @@ MIN_KERN_VER="3.2.0"
 # its seccomp filter!). Please double check this!
 MIN_PAX_UTILS_VER="1.3.3"
 
+# Minimum systemd version needed (which contains any new syscall changes for
+# its seccomp filter!). Please double check this!
+MIN_SYSTEMD_VER="255"
+
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
@@ -130,6 +134,7 @@ DEPEND="${COMMON_DEPEND}
 "
 RDEPEND="${COMMON_DEPEND}
 	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
 	perl? ( dev-lang/perl )
 "
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index d48d26dff251..2b8f64f7e6ad 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -36,6 +36,10 @@ MIN_KERN_VER="3.2.0"
 # its seccomp filter!). Please double check this!
 MIN_PAX_UTILS_VER="1.3.3"
 
+# Minimum systemd version needed (which contains any new syscall changes for
+# its seccomp filter!). Please double check this!
+MIN_SYSTEMD_VER="255"
+
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
@@ -130,6 +134,7 @@ DEPEND="${COMMON_DEPEND}
 "
 RDEPEND="${COMMON_DEPEND}
 	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
 	perl? ( dev-lang/perl )
 "
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-02-24 20:45 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-02-24 20:45 UTC (permalink / raw
  To: gentoo-commits

commit:     e3f89da13628f18b98e0dce65d26b031da7abf4e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 24 20:44:34 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Feb 24 20:45:12 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e3f89da1

sys-libs/glibc: Relax systemd restrictions now we have 254.9-r1

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r1.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.39-r1.ebuild b/sys-libs/glibc/glibc-2.39-r1.ebuild
index cb9a3aab0ec1..f78730d16ac5 100644
--- a/sys-libs/glibc/glibc-2.39-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r1.ebuild
@@ -38,7 +38,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 
 # Minimum systemd version needed (which contains any new syscall changes for
 # its seccomp filter!). Please double check this!
-MIN_SYSTEMD_VER="255"
+MIN_SYSTEMD_VER="254.9-r1"
 
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 2b8f64f7e6ad..f82a00f91c2f 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -38,7 +38,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 
 # Minimum systemd version needed (which contains any new syscall changes for
 # its seccomp filter!). Please double check this!
-MIN_SYSTEMD_VER="255"
+MIN_SYSTEMD_VER="254.9-r1"
 
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-03-03  2:00 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-03-03  2:00 UTC (permalink / raw
  To: gentoo-commits

commit:     a1464e3400cbc98afd2e836646312e63055ce1aa
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  3 02:00:02 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Mar  3 02:00:38 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a1464e34

sys-libs/glibc: 2.39 patchlevel 2 bump

                === Summary of results ===
   5178 PASS
     88 UNSUPPORTED
     20 XFAIL
      6 XPASS
make[1]: Leaving directory '/tmp/portage/sys-libs/glibc-2.39-r2/work/glibc-2.39'
>>> Completed testing sys-libs/glibc-2.39-r2

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.39-r2.ebuild | 1714 +++++++++++++++++++++++++++++++++++
 2 files changed, 1715 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index b18163e4ea57..fc5a41a5c1b0 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -23,6 +23,7 @@ DIST glibc-2.38-patches-10.tar.xz 60792 BLAKE2B e228568f9e9cfa719ee9f2f91d220efa
 DIST glibc-2.38-patches-11.tar.xz 67188 BLAKE2B 5025fd72359842a357e7c2cd76de3e717c9bd117259dd8be93aa6fcd906f8b65e266388bf685e611bfa439d57c03e0a4f7d024d7a766ff275277936f76f1ecbf SHA512 d0fa1c11c153c7ada8668d865a15c7c47013956b5fa1e0d0e2b7e24cea5d3e16909dc8f9ba9b2b392d85271ed71603deb440ead19de50fd61b53a6c1f73d467b
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-2.39-patches-1.tar.xz 14316 BLAKE2B e0a05eb98d11ed4bc332b9267bc363ed8d7cfed8e9a1e7d1e854802830326241b231fc6fcca4f97bf80e52c361863f21fe09e060febe3234e1f6dd9e6cfa78f8 SHA512 0391ed526fc5686fd6e3a01beb18d92702ad7b5f8ad06651f1a1be174b16d7ab367cf3375b98e9c54b9dffee2e3416b22d60963dcf3a96e0d6141b682943ccd2
+DIST glibc-2.39-patches-2.tar.xz 18860 BLAKE2B 9ef3ff522820e650876dcda6ea78294fa5ad5301c2f5284d296a44e6c3c71a401c5da5aa097bdd2c9336fe8f89c931d9b5f8c127d5599c8ae962e2e64718842c SHA512 6cacd95576c5802a800cffa7e2939b3ab7db886ce8ae5e117182ac461ab8c207f4b5c2a05bf80e9214f13d9c9e43d136de0d2dc5f48c3d3389299eafad19a75c
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.39-r2.ebuild b/sys-libs/glibc/glibc-2.39-r2.ebuild
new file mode 100644
index 000000000000..040d0322933c
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.39-r2.ebuild
@@ -0,0 +1,1714 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=2
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+# Minimum systemd version needed (which contains any new syscall changes for
+# its seccomp filter!). Please double check this!
+MIN_SYSTEMD_VER="254.9-r1"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+
+	# Fails regularly, unreliable
+	tst-valgrind-smoke
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	case ${ABI}-${CTARGET} in
+		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-03-03 17:17 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-03-03 17:17 UTC (permalink / raw
  To: gentoo-commits

commit:     37fbcee26ef55b300837033446868f00c4bc0e8c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  3 17:16:41 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Mar  3 17:16:41 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=37fbcee2

sys-libs/glibc: keyword 2.39-r2

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r2.ebuild b/sys-libs/glibc/glibc-2.39-r2.ebuild
index 040d0322933c..b176c2198555 100644
--- a/sys-libs/glibc/glibc-2.39-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r2.ebuild
@@ -43,7 +43,7 @@ MIN_SYSTEMD_VER="254.9-r1"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-03-11 19:20 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-03-11 19:20 UTC (permalink / raw
  To: gentoo-commits

commit:     99fb7418c7de7029635ba480eb53450e423cf953
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 11 19:05:21 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Mar 11 19:20:17 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=99fb7418

sys-libs/glibc: pass -mbranch-protection=none if USE=-cet on arm64

Quoting NEWS:
"""
 [...]
 User code can use PAC-RET
 without libc support, but BTI requires a libc that is built with BTI
 support, otherwise runtime objects linked into user code will not be
 BTI compatible.
"""

This is the same as 0b7eace724b0035856311008c95cc7fe18b8231b but for
newly-introduced-in-Gentoo support for default -mbranch-protection in GCC.

Bug: https://bugs.gentoo.org/916381
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r2.ebuild | 8 ++++++--
 sys-libs/glibc/glibc-9999.ebuild    | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.39-r2.ebuild b/sys-libs/glibc/glibc-2.39-r2.ebuild
index b176c2198555..236484af1eeb 100644
--- a/sys-libs/glibc/glibc-2.39-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r2.ebuild
@@ -512,8 +512,12 @@ setup_flags() {
 	# should not be a problem, but for glibc it matters as it is
 	# dealing with CET in ld.so. So if CET is supposed to be
 	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
+	if ! use cet; then
+		if use amd64 || use x86; then
+			append-flags '-fcf-protection=none'
+		elif use arm64; then
+			append-flags '-mbranch-protection=none'
+		fi
 	fi
 }
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f82a00f91c2f..5a0caff2e597 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -512,8 +512,12 @@ setup_flags() {
 	# should not be a problem, but for glibc it matters as it is
 	# dealing with CET in ld.so. So if CET is supposed to be
 	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
+	if ! use cet; then
+		if use amd64 || use x86; then
+			append-flags '-fcf-protection=none'
+		elif use arm64; then
+			append-flags '-mbranch-protection=none'
+		fi
 	fi
 }
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-03-18 14:59 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-03-18 14:59 UTC (permalink / raw
  To: gentoo-commits

commit:     2c8434567712bbb453b5c596913c3ce97ce360bb
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 18 14:59:36 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Mar 18 14:59:36 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2c843456

sys-libs/glibc: Stabilize 2.38-r11 arm64, #927238

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r11.ebuild b/sys-libs/glibc/glibc-2.38-r11.ebuild
index efa9537fe355..a20a1d1121a0 100644
--- a/sys-libs/glibc/glibc-2.38-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r11.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-03-22  4:14 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-03-22  4:14 UTC (permalink / raw
  To: gentoo-commits

commit:     f1f33460d9c5887cd6a218e3b3c9804b6f79ad21
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 22 04:14:23 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 22 04:14:23 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f1f33460

sys-libs/glibc: Stabilize 2.38-r11 ppc64, #927238

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r11.ebuild b/sys-libs/glibc/glibc-2.38-r11.ebuild
index 39b51dc3001e..2d213e9723cf 100644
--- a/sys-libs/glibc/glibc-2.38-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r11.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-06  6:51 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-04-06  6:51 UTC (permalink / raw
  To: gentoo-commits

commit:     05256e4daad4b3aff5eb2801c9b9bd587d05b026
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  6 06:51:02 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Apr  6 06:51:02 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=05256e4d

sys-libs/glibc: Stabilize 2.38-r11 sparc, #927238

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r11.ebuild b/sys-libs/glibc/glibc-2.38-r11.ebuild
index c1dbfb8c0723..6933f67d4476 100644
--- a/sys-libs/glibc/glibc-2.38-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r11.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-06  6:51 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-04-06  6:51 UTC (permalink / raw
  To: gentoo-commits

commit:     06a5fc1066d088310aa8fd69f4573a17502378a3
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  6 06:50:56 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Apr  6 06:50:56 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06a5fc10

sys-libs/glibc: Stabilize 2.38-r11 amd64, #927238

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r11.ebuild b/sys-libs/glibc/glibc-2.38-r11.ebuild
index 2d213e9723cf..cdedb8c37230 100644
--- a/sys-libs/glibc/glibc-2.38-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r11.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-06  6:51 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-04-06  6:51 UTC (permalink / raw
  To: gentoo-commits

commit:     eb21a06923bab92d11b48de6764501db2d9c3d9c
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  6 06:51:06 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Apr  6 06:51:06 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eb21a069

sys-libs/glibc: Stabilize 2.38-r11 x86, #927238

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r11.ebuild b/sys-libs/glibc/glibc-2.38-r11.ebuild
index 6933f67d4476..8da751b46e7c 100644
--- a/sys-libs/glibc/glibc-2.38-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r11.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-06  6:51 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-04-06  6:51 UTC (permalink / raw
  To: gentoo-commits

commit:     ff6205487720bedb977a2bb96d769747c946d29f
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  6 06:50:59 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Apr  6 06:50:59 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ff620548

sys-libs/glibc: Stabilize 2.38-r11 arm, #927238

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r11.ebuild b/sys-libs/glibc/glibc-2.38-r11.ebuild
index cdedb8c37230..c1dbfb8c0723 100644
--- a/sys-libs/glibc/glibc-2.38-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r11.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-13 18:41 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-04-13 18:41 UTC (permalink / raw
  To: gentoo-commits

commit:     39ba3e621469464a59dc7a37e3c41366d7856066
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 13 18:38:11 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 13 18:40:53 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=39ba3e62

sys-libs/glibc: backport CPP fix to 2.38-r11, sync live

And fix style to be consistent wrt quoting too.

Bug: https://bugs.gentoo.org/927652
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r11.ebuild | 6 ++++++
 sys-libs/glibc/glibc-2.39-r2.ebuild  | 2 +-
 sys-libs/glibc/glibc-9999.ebuild     | 6 ++++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r11.ebuild b/sys-libs/glibc/glibc-2.38-r11.ebuild
index 8da751b46e7c..93f0999d1d03 100644
--- a/sys-libs/glibc/glibc-2.38-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r11.ebuild
@@ -576,10 +576,12 @@ setup_env() {
 	# Reset CC and CXX to the value at start of emerge
 	export CC=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
 	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
 
 	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
 	export glibc__ORIG_CC=${CC}
 	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP=${CPP}
 
 	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
 		export glibc__force_gcc=yes
@@ -606,6 +608,7 @@ setup_env() {
 		export CC="${current_gcc_path}/gcc"
 		export CPP="${current_gcc_path}/cpp"
 		export CXX="${current_gcc_path}/g++"
+		export CPP="$(tc-getCPP ${CTARGET})"
 		export LD="${current_binutils_path}/ld.bfd"
 		export AR="${current_binutils_path}/ar"
 		export AS="${current_binutils_path}/as"
@@ -644,6 +647,7 @@ setup_env() {
 	# acts on CC?)
 	export glibc__GLIBC_CC=${CC}
 	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
 
 	export glibc__abi_CFLAGS="$(get_abi_CFLAGS)"
 
@@ -659,6 +663,8 @@ setup_env() {
 	# Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548
 	export CXX="${glibc__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
 
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS}"
+
 	if is_crosscompile; then
 		# Assume worst-case bootstrap: glibc is built for the first time
 		# with ${CTARGET}-g++ not available yet. We avoid

diff --git a/sys-libs/glibc/glibc-2.39-r2.ebuild b/sys-libs/glibc/glibc-2.39-r2.ebuild
index 7624666b6723..ab73ae4098aa 100644
--- a/sys-libs/glibc/glibc-2.39-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r2.ebuild
@@ -594,7 +594,7 @@ setup_env() {
 	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
 	export glibc__ORIG_CC=${CC}
 	export glibc__ORIG_CXX=${CXX}
-	export glibc__ORIG_CPP="${CPP}"
+	export glibc__ORIG_CPP=${CPP}
 
 	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
 		export glibc__force_gcc=yes

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 5a0caff2e597..c6fc206e2d4f 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -589,10 +589,12 @@ setup_env() {
 	# Reset CC and CXX to the value at start of emerge
 	export CC=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
 	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
 
 	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
 	export glibc__ORIG_CC=${CC}
 	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP=${CPP}
 
 	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
 		export glibc__force_gcc=yes
@@ -641,6 +643,7 @@ setup_env() {
 
 		export CC="$(tc-getCC ${CTARGET})"
 		export CXX="$(tc-getCXX ${CTARGET})"
+		export CPP="$(tc-getCPP ${CTARGET})"
 
 		# Always use tuple-prefixed toolchain. For non-native ABI glibc's configure
 		# can't detect them automatically due to ${CHOST} mismatch and fallbacks
@@ -657,6 +660,7 @@ setup_env() {
 	# acts on CC?)
 	export glibc__GLIBC_CC=${CC}
 	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
 
 	export glibc__abi_CFLAGS="$(get_abi_CFLAGS)"
 
@@ -672,6 +676,8 @@ setup_env() {
 	# Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548
 	export CXX="${glibc__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
 
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS}"
+
 	if is_crosscompile; then
 		# Assume worst-case bootstrap: glibc is built for the first time
 		# with ${CTARGET}-g++ not available yet. We avoid


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-13 18:41 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-04-13 18:41 UTC (permalink / raw
  To: gentoo-commits

commit:     30e32d9ed408fd786e9c1e16063c1228d123ebc1
Author:     Alfred Wingate <parona <AT> protonmail <DOT> com>
AuthorDate: Wed Apr 10 20:36:37 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 13 18:40:52 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=30e32d9e

sys-libs/glibc: export CPP similarily to CC and CXX

* This is copies the approach that CC and CXX use, so that the correct
  abi is used. Otherwise an abi_x86_32 configure test could
  automagically enable CET which isn't available on abi_x86_32.

Bug: https://bugs.gentoo.org/927652
Signed-off-by: Alfred Wingate <parona <AT> protonmail.com>
Closes: https://github.com/gentoo/gentoo/pull/36200
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r2.ebuild | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.39-r2.ebuild b/sys-libs/glibc/glibc-2.39-r2.ebuild
index 236484af1eeb..7624666b6723 100644
--- a/sys-libs/glibc/glibc-2.39-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r2.ebuild
@@ -589,10 +589,12 @@ setup_env() {
 	# Reset CC and CXX to the value at start of emerge
 	export CC=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
 	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
 
 	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
 	export glibc__ORIG_CC=${CC}
 	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP="${CPP}"
 
 	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
 		export glibc__force_gcc=yes
@@ -641,6 +643,7 @@ setup_env() {
 
 		export CC="$(tc-getCC ${CTARGET})"
 		export CXX="$(tc-getCXX ${CTARGET})"
+		export CPP="$(tc-getCPP ${CTARGET})"
 
 		# Always use tuple-prefixed toolchain. For non-native ABI glibc's configure
 		# can't detect them automatically due to ${CHOST} mismatch and fallbacks
@@ -657,6 +660,7 @@ setup_env() {
 	# acts on CC?)
 	export glibc__GLIBC_CC=${CC}
 	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
 
 	export glibc__abi_CFLAGS="$(get_abi_CFLAGS)"
 
@@ -672,6 +676,8 @@ setup_env() {
 	# Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548
 	export CXX="${glibc__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
 
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS}"
+
 	if is_crosscompile; then
 		# Assume worst-case bootstrap: glibc is built for the first time
 		# with ${CTARGET}-g++ not available yet. We avoid


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-18  0:39 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-04-18  0:39 UTC (permalink / raw
  To: gentoo-commits

commit:     3931b13e56d8a3fe3d2bcec3f86f1140bcb3217b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 18 00:38:17 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Apr 18 00:39:35 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3931b13e

sys-libs/glibc: 2.38 and 2.39 revbump for CVE-2024-2961, GLIBC-SA-2024-0004

Bug: https://bugs.gentoo.org/930177
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    2 +
 sys-libs/glibc/glibc-2.38-r12.ebuild | 1724 ++++++++++++++++++++++++++++++++++
 sys-libs/glibc/glibc-2.39-r3.ebuild  | 1724 ++++++++++++++++++++++++++++++++++
 3 files changed, 3450 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index fc5a41a5c1b0..79ba9f613621 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -21,9 +21,11 @@ DIST glibc-2.37-patches-12.tar.xz 83716 BLAKE2B 123951d94dad6c22150c4ef2299bcaaf
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-10.tar.xz 60792 BLAKE2B e228568f9e9cfa719ee9f2f91d220efa53e4eba617377fdf37bf7381b9f7c43036dfe62dd284b4228e9a99d41223ed0416ed058407a630b84064962518cba90b SHA512 573661299d75b63b7e2f771e9032193492e762e64cbb495b42bb7ad1021532f54f19d829a721e8070c79b2ad5edef077584cc4c76896d951cc93275592cf255c
 DIST glibc-2.38-patches-11.tar.xz 67188 BLAKE2B 5025fd72359842a357e7c2cd76de3e717c9bd117259dd8be93aa6fcd906f8b65e266388bf685e611bfa439d57c03e0a4f7d024d7a766ff275277936f76f1ecbf SHA512 d0fa1c11c153c7ada8668d865a15c7c47013956b5fa1e0d0e2b7e24cea5d3e16909dc8f9ba9b2b392d85271ed71603deb440ead19de50fd61b53a6c1f73d467b
+DIST glibc-2.38-patches-12.tar.xz 83568 BLAKE2B 051f32976d82cfe510084a94a4a40f328531eab8601454685c906405a96bb92527780378ccf6bfa42ab9cbadc405545d3bd28d0c4a15927d1a1c18a7a23c513f SHA512 a66d567680f5b34e35d1e4c5c2a4a9b0af67450cc0ea4a03074ec66953d79e4d0e9e921ca44717b3ca45f5910a8cdb033818bc111efd93b41666610cc8478b67
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-2.39-patches-1.tar.xz 14316 BLAKE2B e0a05eb98d11ed4bc332b9267bc363ed8d7cfed8e9a1e7d1e854802830326241b231fc6fcca4f97bf80e52c361863f21fe09e060febe3234e1f6dd9e6cfa78f8 SHA512 0391ed526fc5686fd6e3a01beb18d92702ad7b5f8ad06651f1a1be174b16d7ab367cf3375b98e9c54b9dffee2e3416b22d60963dcf3a96e0d6141b682943ccd2
 DIST glibc-2.39-patches-2.tar.xz 18860 BLAKE2B 9ef3ff522820e650876dcda6ea78294fa5ad5301c2f5284d296a44e6c3c71a401c5da5aa097bdd2c9336fe8f89c931d9b5f8c127d5599c8ae962e2e64718842c SHA512 6cacd95576c5802a800cffa7e2939b3ab7db886ce8ae5e117182ac461ab8c207f4b5c2a05bf80e9214f13d9c9e43d136de0d2dc5f48c3d3389299eafad19a75c
+DIST glibc-2.39-patches-3.tar.xz 69980 BLAKE2B 08239eb30c0059ea7ff750287f9349ebc4dff3416aa4711db2cdfedf5a01ba000e135b390528cc77e50c20cb2656aaa571c299542b495fe72828301f61702548 SHA512 47c87e568ce6bdddf42605d8c422869c238be13e77905051b214fed51265de0cd35c2031d0fc906019058f5a159b6b99ed52cb177450db2f710ce398770b3e85
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.38-r12.ebuild b/sys-libs/glibc/glibc-2.38-r12.ebuild
new file mode 100644
index 000000000000..eea77fdf8fa2
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.38-r12.ebuild
@@ -0,0 +1,1724 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=12
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP=${CPP}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		export CXX="${current_gcc_path}/g++"
+		export CPP="$(tc-getCPP ${CTARGET})"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# we give the tests a bit more time to avoid spurious
+	# bug reports on slow arches
+
+	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}

diff --git a/sys-libs/glibc/glibc-2.39-r3.ebuild b/sys-libs/glibc/glibc-2.39-r3.ebuild
new file mode 100644
index 000000000000..bb2b296d5c61
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.39-r3.ebuild
@@ -0,0 +1,1724 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=3
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+# Minimum systemd version needed (which contains any new syscall changes for
+# its seccomp filter!). Please double check this!
+MIN_SYSTEMD_VER="254.9-r1"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+
+	# Fails regularly, unreliable
+	tst-valgrind-smoke
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if ! use cet; then
+		if use amd64 || use x86; then
+			append-flags '-fcf-protection=none'
+		elif use arm64; then
+			append-flags '-mbranch-protection=none'
+		fi
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP=${CPP}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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})"
+		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	case ${ABI}-${CTARGET} in
+		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-18  2:42 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-04-18  2:42 UTC (permalink / raw
  To: gentoo-commits

commit:     c8234d44e99abfd5a655d66b63979db4ca853354
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 18 01:52:17 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Apr 18 01:52:17 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8234d44

sys-libs/glibc: keyword 2.38-r12

Bug: https://bugs.gentoo.org/930177
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r12.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r12.ebuild b/sys-libs/glibc/glibc-2.38-r12.ebuild
index eea77fdf8fa2..e55dc707ba7e 100644
--- a/sys-libs/glibc/glibc-2.38-r12.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r12.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-18  2:42 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-04-18  2:42 UTC (permalink / raw
  To: gentoo-commits

commit:     2f55bd37a5e0c43c06a528909afb2b1e786173a3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 18 02:42:14 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Apr 18 02:42:14 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2f55bd37

sys-libs/glibc: keyword 2.39-r3

Bug: https://bugs.gentoo.org/930177
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r3.ebuild b/sys-libs/glibc/glibc-2.39-r3.ebuild
index bb2b296d5c61..f53dac7811b7 100644
--- a/sys-libs/glibc/glibc-2.39-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r3.ebuild
@@ -43,7 +43,7 @@ MIN_SYSTEMD_VER="254.9-r1"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-19 10:47 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-04-19 10:47 UTC (permalink / raw
  To: gentoo-commits

commit:     af5af42eac9ef1c23b7c77d34b14667b779676f5
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 19 10:46:57 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Apr 19 10:47:39 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=af5af42e

sys-libs/glibc: drop 2.39-r1, 2.39-r2

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 -
 sys-libs/glibc/glibc-2.39-r1.ebuild | 1714 ----------------------------------
 sys-libs/glibc/glibc-2.39-r2.ebuild | 1724 -----------------------------------
 3 files changed, 3440 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 79ba9f613621..4571f2d2a6fc 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -23,8 +23,6 @@ DIST glibc-2.38-patches-10.tar.xz 60792 BLAKE2B e228568f9e9cfa719ee9f2f91d220efa
 DIST glibc-2.38-patches-11.tar.xz 67188 BLAKE2B 5025fd72359842a357e7c2cd76de3e717c9bd117259dd8be93aa6fcd906f8b65e266388bf685e611bfa439d57c03e0a4f7d024d7a766ff275277936f76f1ecbf SHA512 d0fa1c11c153c7ada8668d865a15c7c47013956b5fa1e0d0e2b7e24cea5d3e16909dc8f9ba9b2b392d85271ed71603deb440ead19de50fd61b53a6c1f73d467b
 DIST glibc-2.38-patches-12.tar.xz 83568 BLAKE2B 051f32976d82cfe510084a94a4a40f328531eab8601454685c906405a96bb92527780378ccf6bfa42ab9cbadc405545d3bd28d0c4a15927d1a1c18a7a23c513f SHA512 a66d567680f5b34e35d1e4c5c2a4a9b0af67450cc0ea4a03074ec66953d79e4d0e9e921ca44717b3ca45f5910a8cdb033818bc111efd93b41666610cc8478b67
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
-DIST glibc-2.39-patches-1.tar.xz 14316 BLAKE2B e0a05eb98d11ed4bc332b9267bc363ed8d7cfed8e9a1e7d1e854802830326241b231fc6fcca4f97bf80e52c361863f21fe09e060febe3234e1f6dd9e6cfa78f8 SHA512 0391ed526fc5686fd6e3a01beb18d92702ad7b5f8ad06651f1a1be174b16d7ab367cf3375b98e9c54b9dffee2e3416b22d60963dcf3a96e0d6141b682943ccd2
-DIST glibc-2.39-patches-2.tar.xz 18860 BLAKE2B 9ef3ff522820e650876dcda6ea78294fa5ad5301c2f5284d296a44e6c3c71a401c5da5aa097bdd2c9336fe8f89c931d9b5f8c127d5599c8ae962e2e64718842c SHA512 6cacd95576c5802a800cffa7e2939b3ab7db886ce8ae5e117182ac461ab8c207f4b5c2a05bf80e9214f13d9c9e43d136de0d2dc5f48c3d3389299eafad19a75c
 DIST glibc-2.39-patches-3.tar.xz 69980 BLAKE2B 08239eb30c0059ea7ff750287f9349ebc4dff3416aa4711db2cdfedf5a01ba000e135b390528cc77e50c20cb2656aaa571c299542b495fe72828301f61702548 SHA512 47c87e568ce6bdddf42605d8c422869c238be13e77905051b214fed51265de0cd35c2031d0fc906019058f5a159b6b99ed52cb177450db2f710ce398770b3e85
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238

diff --git a/sys-libs/glibc/glibc-2.39-r1.ebuild b/sys-libs/glibc/glibc-2.39-r1.ebuild
deleted file mode 100644
index f78730d16ac5..000000000000
--- a/sys-libs/glibc/glibc-2.39-r1.ebuild
+++ /dev/null
@@ -1,1714 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..12} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=1
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-# Minimum systemd version needed (which contains any new syscall changes for
-# its seccomp filter!). Please double check this!
-MIN_SYSTEMD_VER="254.9-r1"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# - similarly, valgrind requires knowledge about symbols in ld.so:
-#	bug #920753
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-
-	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
-	tst-sched1
-
-	# Fails regularly, unreliable
-	tst-valgrind-smoke
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	case ${ABI}-${CTARGET} in
-		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	# valgrind requires knowledge about ld.so symbols.
-	dostrip -x $(alt_libdir)/ld-*.so*
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.39-r2.ebuild b/sys-libs/glibc/glibc-2.39-r2.ebuild
deleted file mode 100644
index ab73ae4098aa..000000000000
--- a/sys-libs/glibc/glibc-2.39-r2.ebuild
+++ /dev/null
@@ -1,1724 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..12} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=2
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-# Minimum systemd version needed (which contains any new syscall changes for
-# its seccomp filter!). Please double check this!
-MIN_SYSTEMD_VER="254.9-r1"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# - similarly, valgrind requires knowledge about symbols in ld.so:
-#	bug #920753
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-
-	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
-	tst-sched1
-
-	# Fails regularly, unreliable
-	tst-valgrind-smoke
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if ! use cet; then
-		if use amd64 || use x86; then
-			append-flags '-fcf-protection=none'
-		elif use arm64; then
-			append-flags '-mbranch-protection=none'
-		fi
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-	export glibc__ORIG_CPP=${CPP}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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})"
-		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-	export glibc__GLIBC_CPP=${CPP}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	case ${ABI}-${CTARGET} in
-		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	# valgrind requires knowledge about ld.so symbols.
-	dostrip -x $(alt_libdir)/ld-*.so*
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-20  9:42 Michał Górny
  0 siblings, 0 replies; 1076+ messages in thread
From: Michał Górny @ 2024-04-20  9:42 UTC (permalink / raw
  To: gentoo-commits

commit:     c184c2cb2d314ae11b523124dec50b55fa19845a
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 20 09:42:19 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Apr 20 09:42:19 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c184c2cb

sys-libs/glibc: Stabilize 2.38-r12 arm64, #930274

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r12.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r12.ebuild b/sys-libs/glibc/glibc-2.38-r12.ebuild
index e55dc707ba7e..95b9da73a833 100644
--- a/sys-libs/glibc/glibc-2.38-r12.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r12.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-20  9:42 Michał Górny
  0 siblings, 0 replies; 1076+ messages in thread
From: Michał Górny @ 2024-04-20  9:42 UTC (permalink / raw
  To: gentoo-commits

commit:     cf3a2ac05d951f477c8ae3c470f448d9d7980bc3
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 20 09:42:21 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Apr 20 09:42:21 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf3a2ac0

sys-libs/glibc: Stabilize 2.38-r12 ppc64, #930274

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r12.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r12.ebuild b/sys-libs/glibc/glibc-2.38-r12.ebuild
index 5ef28ba0923d..3b8eb3e54825 100644
--- a/sys-libs/glibc/glibc-2.38-r12.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r12.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-20  9:42 Michał Górny
  0 siblings, 0 replies; 1076+ messages in thread
From: Michał Górny @ 2024-04-20  9:42 UTC (permalink / raw
  To: gentoo-commits

commit:     7ff3215c852d7f74a40c521f8d919536a9056334
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 20 09:42:20 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Apr 20 09:42:20 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7ff3215c

sys-libs/glibc: Stabilize 2.38-r12 ppc, #930274

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r12.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r12.ebuild b/sys-libs/glibc/glibc-2.38-r12.ebuild
index 95b9da73a833..5ef28ba0923d 100644
--- a/sys-libs/glibc/glibc-2.38-r12.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r12.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-20 18:08 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-04-20 18:08 UTC (permalink / raw
  To: gentoo-commits

commit:     f201c5205e04609dbd06ad35043fb4cf799545e7
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 20 18:08:32 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 20 18:08:32 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f201c520

sys-libs/glibc: Stabilize 2.38-r12 x86, #930274

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r12.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r12.ebuild b/sys-libs/glibc/glibc-2.38-r12.ebuild
index d1745d417568..aef3c5d5d479 100644
--- a/sys-libs/glibc/glibc-2.38-r12.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r12.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-20 18:08 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-04-20 18:08 UTC (permalink / raw
  To: gentoo-commits

commit:     7d58d28ea04e3c54ad8e298e4176e3f2beee4c0c
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 20 18:08:29 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 20 18:08:29 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7d58d28e

sys-libs/glibc: Stabilize 2.38-r12 amd64, #930274

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r12.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r12.ebuild b/sys-libs/glibc/glibc-2.38-r12.ebuild
index 3b8eb3e54825..d1745d417568 100644
--- a/sys-libs/glibc/glibc-2.38-r12.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r12.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-23 14:40 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-04-23 14:40 UTC (permalink / raw
  To: gentoo-commits

commit:     4439bf758dc2bfc1584f646c055ee54a1a6c2b43
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 23 14:38:53 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Apr 23 14:40:01 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4439bf75

sys-libs/glibc: fix CPP definition

On sparc, this might break if e.g. -mcpu is in CFLAGS. It's similar to
the arm case already mentioned.

Reported by Dakon:
"ok, it greps for __sparc_v8 or __sparc_v9 cpp output, but it does not pass the -mcpu
I have in CFLAGS, so it falls back to the compiler default which still is v7"

Fixes: 30e32d9ed408fd786e9c1e16063c1228d123ebc1
Fixes: 39ba3e621469464a59dc7a37e3c41366d7856066
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r12.ebuild | 2 +-
 sys-libs/glibc/glibc-2.39-r3.ebuild  | 2 +-
 sys-libs/glibc/glibc-9999.ebuild     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.38-r12.ebuild b/sys-libs/glibc/glibc-2.38-r12.ebuild
index aef3c5d5d479..88280475bb10 100644
--- a/sys-libs/glibc/glibc-2.38-r12.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r12.ebuild
@@ -663,7 +663,7 @@ setup_env() {
 	# Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548
 	export CXX="${glibc__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
 
-	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS}"
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
 
 	if is_crosscompile; then
 		# Assume worst-case bootstrap: glibc is built for the first time

diff --git a/sys-libs/glibc/glibc-2.39-r3.ebuild b/sys-libs/glibc/glibc-2.39-r3.ebuild
index f53dac7811b7..1e6aadbb04e3 100644
--- a/sys-libs/glibc/glibc-2.39-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r3.ebuild
@@ -676,7 +676,7 @@ setup_env() {
 	# Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548
 	export CXX="${glibc__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
 
-	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS}"
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
 
 	if is_crosscompile; then
 		# Assume worst-case bootstrap: glibc is built for the first time

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index c6fc206e2d4f..c3dce15e7e99 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -676,7 +676,7 @@ setup_env() {
 	# Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548
 	export CXX="${glibc__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
 
-	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS}"
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
 
 	if is_crosscompile; then
 		# Assume worst-case bootstrap: glibc is built for the first time


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-24 15:02 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-04-24 15:02 UTC (permalink / raw
  To: gentoo-commits

commit:     d053dd357e845f6a478ce7f47ba2a0d0dba3e3b1
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Wed Apr 24 13:59:12 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Apr 24 15:02:06 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d053dd35

sys-libs/glibc: stable 2.38-r12 for sparc, bug #930274

Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r12.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r12.ebuild b/sys-libs/glibc/glibc-2.38-r12.ebuild
index 88280475bb10..9c1814df87de 100644
--- a/sys-libs/glibc/glibc-2.38-r12.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r12.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-26 10:02 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-04-26 10:02 UTC (permalink / raw
  To: gentoo-commits

commit:     918c29edc3708b2963f0b8686bb41b49e5a75c34
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 26 09:58:47 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Apr 26 10:02:13 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=918c29ed

sys-libs/glibc: add 2.38 patchset 13 and 2.39 patchset 4

Bug: https://bugs.gentoo.org/930667
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    2 +
 sys-libs/glibc/glibc-2.38-r13.ebuild | 1724 ++++++++++++++++++++++++++++++++++
 sys-libs/glibc/glibc-2.39-r4.ebuild  | 1724 ++++++++++++++++++++++++++++++++++
 3 files changed, 3450 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 4571f2d2a6fc..429274fcef77 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -22,8 +22,10 @@ DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb8
 DIST glibc-2.38-patches-10.tar.xz 60792 BLAKE2B e228568f9e9cfa719ee9f2f91d220efa53e4eba617377fdf37bf7381b9f7c43036dfe62dd284b4228e9a99d41223ed0416ed058407a630b84064962518cba90b SHA512 573661299d75b63b7e2f771e9032193492e762e64cbb495b42bb7ad1021532f54f19d829a721e8070c79b2ad5edef077584cc4c76896d951cc93275592cf255c
 DIST glibc-2.38-patches-11.tar.xz 67188 BLAKE2B 5025fd72359842a357e7c2cd76de3e717c9bd117259dd8be93aa6fcd906f8b65e266388bf685e611bfa439d57c03e0a4f7d024d7a766ff275277936f76f1ecbf SHA512 d0fa1c11c153c7ada8668d865a15c7c47013956b5fa1e0d0e2b7e24cea5d3e16909dc8f9ba9b2b392d85271ed71603deb440ead19de50fd61b53a6c1f73d467b
 DIST glibc-2.38-patches-12.tar.xz 83568 BLAKE2B 051f32976d82cfe510084a94a4a40f328531eab8601454685c906405a96bb92527780378ccf6bfa42ab9cbadc405545d3bd28d0c4a15927d1a1c18a7a23c513f SHA512 a66d567680f5b34e35d1e4c5c2a4a9b0af67450cc0ea4a03074ec66953d79e4d0e9e921ca44717b3ca45f5910a8cdb033818bc111efd93b41666610cc8478b67
+DIST glibc-2.38-patches-13.tar.xz 92708 BLAKE2B b2f05a793c92ea0b7901d2124fcd968fa846fdf687f8cbdbc17795c33fae2d538133fae66d575c5b98a7a05a29f9f816e7ecd45f3be5ed10ef65adbf92c7fc4d SHA512 24e45a88fa7676ef22a7e2bb864dff27262f69900c4ef76d21c6fee498d728949b6f5d03dd094d1774a66a8a47b779bf4b16ee31e5306bcdb55cedcc0a1c5e9f
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-2.39-patches-3.tar.xz 69980 BLAKE2B 08239eb30c0059ea7ff750287f9349ebc4dff3416aa4711db2cdfedf5a01ba000e135b390528cc77e50c20cb2656aaa571c299542b495fe72828301f61702548 SHA512 47c87e568ce6bdddf42605d8c422869c238be13e77905051b214fed51265de0cd35c2031d0fc906019058f5a159b6b99ed52cb177450db2f710ce398770b3e85
+DIST glibc-2.39-patches-4.tar.xz 77228 BLAKE2B 64ead3c5f20092cde8ccd91692e556e412cfbe8ec22917db29a752ac9d8df2b1bcd20ce288253790ce391dcf82fcfec1f2a0895ae7d17842d45246d8d8881a6a SHA512 a84b76131a5c7c5c4d242dbefc124932a24177095a6447c715f9f8654cdd83190434d492c7ae3bf47b6e6eb717aae046b76647d653854add3d32e9e4b9fbefbe
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.38-r13.ebuild b/sys-libs/glibc/glibc-2.38-r13.ebuild
new file mode 100644
index 000000000000..34986b171d04
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.38-r13.ebuild
@@ -0,0 +1,1724 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=13
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if (use amd64 || use x86) && ! use cet; then
+		append-flags '-fcf-protection=none'
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP=${CPP}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		export CXX="${current_gcc_path}/g++"
+		export CPP="$(tc-getCPP ${CTARGET})"
+		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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
+	case ${CTARGET} in
+		x86_64-*) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_enable crypt)
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# ia64 static cross-compilers are a pita in so much that they
+	# can't produce static ELFs (as the libgcc.a is broken).  so
+	# disable building of the programs for those targets if it
+	# doesn't work.
+	# XXX: We could turn this into a compiler test, but ia64 is
+	# the only one that matters, so this should be fine for now.
+	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+		sed -i '1i+link-static = touch $@' config.make
+	fi
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--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}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# we give the tests a bit more time to avoid spurious
+	# bug reports on slow arches
+
+	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}

diff --git a/sys-libs/glibc/glibc-2.39-r4.ebuild b/sys-libs/glibc/glibc-2.39-r4.ebuild
new file mode 100644
index 000000000000..08fc7ea4e226
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.39-r4.ebuild
@@ -0,0 +1,1724 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=4
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+# Minimum systemd version needed (which contains any new syscall changes for
+# its seccomp filter!). Please double check this!
+MIN_SYSTEMD_VER="254.9-r1"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+
+	# Fails regularly, unreliable
+	tst-valgrind-smoke
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if ! use cet; then
+		if use amd64 || use x86; then
+			append-flags '-fcf-protection=none'
+		elif use arm64; then
+			append-flags '-mbranch-protection=none'
+		fi
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP=${CPP}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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})"
+		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	case ${ABI}-${CTARGET} in
+		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-26 13:42 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-04-26 13:42 UTC (permalink / raw
  To: gentoo-commits

commit:     f6e370497ba3ed974fc0808ecbed57443b27d5f3
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 26 13:41:47 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Apr 26 13:42:26 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f6e37049

sys-libs/glibc: rekeyword 2.38-r13 and 2.39-r4

Bug: https://bugs.gentoo.org/930667
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r13.ebuild | 2 +-
 sys-libs/glibc/glibc-2.39-r4.ebuild  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.38-r13.ebuild b/sys-libs/glibc/glibc-2.38-r13.ebuild
index 34986b171d04..12cffc756466 100644
--- a/sys-libs/glibc/glibc-2.38-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r13.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi

diff --git a/sys-libs/glibc/glibc-2.39-r4.ebuild b/sys-libs/glibc/glibc-2.39-r4.ebuild
index 08fc7ea4e226..0033fe226b27 100644
--- a/sys-libs/glibc/glibc-2.39-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r4.ebuild
@@ -43,7 +43,7 @@ MIN_SYSTEMD_VER="254.9-r1"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-26 18:16 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-04-26 18:16 UTC (permalink / raw
  To: gentoo-commits

commit:     7870468f097841f922eab572e5e23c9ee30daf63
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 26 18:15:55 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Apr 26 18:15:55 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7870468f

sys-libs/glibc: Stabilize 2.38-r13 arm64, #930703

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r13.ebuild b/sys-libs/glibc/glibc-2.38-r13.ebuild
index 12cffc756466..33ba9f7841ba 100644
--- a/sys-libs/glibc/glibc-2.38-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r13.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-26 18:37 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-04-26 18:37 UTC (permalink / raw
  To: gentoo-commits

commit:     4c97f548abaf859e20c34f87affd80a32011e099
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 26 18:36:53 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Apr 26 18:36:53 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4c97f548

sys-libs/glibc: Stabilize 2.38-r13 ppc, #930703

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r13.ebuild b/sys-libs/glibc/glibc-2.38-r13.ebuild
index 33ba9f7841ba..f89f594c4b23 100644
--- a/sys-libs/glibc/glibc-2.38-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r13.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-26 18:40 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-04-26 18:40 UTC (permalink / raw
  To: gentoo-commits

commit:     1fe94d6045068dd0385c8daf14b74b322dc86185
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 26 18:39:52 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Apr 26 18:39:52 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1fe94d60

sys-libs/glibc: Stabilize 2.38-r13 amd64, #930703

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r13.ebuild b/sys-libs/glibc/glibc-2.38-r13.ebuild
index f89f594c4b23..35eaf63a789f 100644
--- a/sys-libs/glibc/glibc-2.38-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r13.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-26 18:46 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-04-26 18:46 UTC (permalink / raw
  To: gentoo-commits

commit:     6f88d06c85b10bf51ffcd05f9c2ad419c914202f
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 26 18:46:31 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Apr 26 18:46:31 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f88d06c

sys-libs/glibc: Stabilize 2.38-r13 ppc64, #930703

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r13.ebuild b/sys-libs/glibc/glibc-2.38-r13.ebuild
index 35eaf63a789f..11905f8503e2 100644
--- a/sys-libs/glibc/glibc-2.38-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r13.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-26 19:36 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-04-26 19:36 UTC (permalink / raw
  To: gentoo-commits

commit:     80085d0f25460274dd4f37a39852e75004e37c42
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 26 18:48:03 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Apr 26 19:35:49 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=80085d0f

sys-libs/glibc: fix too-long lines, variable order

Still a bunch of too-long lines to address though.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r3.ebuild | 33 ++++++++++++++++++++-------------
 sys-libs/glibc/glibc-2.39-r4.ebuild | 33 ++++++++++++++++++++-------------
 sys-libs/glibc/glibc-9999.ebuild    | 33 ++++++++++++++++++++-------------
 3 files changed, 60 insertions(+), 39 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.39-r3.ebuild b/sys-libs/glibc/glibc-2.39-r3.ebuild
index 1e6aadbb04e3..8a1b09f69a23 100644
--- a/sys-libs/glibc/glibc-2.39-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r3.ebuild
@@ -9,14 +9,6 @@ EAPI=8
 PYTHON_COMPAT=( python3_{10..12} )
 TMPFILES_OPTIONAL=1
 
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
@@ -40,6 +32,12 @@ MIN_PAX_UTILS_VER="1.3.3"
 # its seccomp filter!). Please double check this!
 MIN_SYSTEMD_VER="254.9-r1"
 
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
@@ -51,6 +49,8 @@ fi
 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 )"
 
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
 IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
 
 # Here's how the cross-compile logic breaks down ...
@@ -213,7 +213,9 @@ XFAIL_NSPAWN_TEST_LIST=(
 dump_build_environment() {
 	einfo ==== glibc build environment ========================================================
 	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
+		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
+		STRINGS OBJDUMP READELF; do
 		einfo " $(printf '%15s' ${v}:)   ${!v}"
 	done
 	einfo =====================================================================================
@@ -256,7 +258,9 @@ alt_build_headers() {
 		if tc-is-cross-compiler ; then
 			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
 			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				local header_path=$(echo '#include <linux/version.h>' \
+					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
+					| grep -o '[^"]*linux/version.h')
 				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
 			fi
 		fi
@@ -1363,9 +1367,11 @@ glibc_do_src_install() {
 		# Move versioned .a file out of libdir to evade portage QA checks
 		# instead of using gen_usr_ldscript(). We fix ldscript as:
 		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
+			"${ED}"/$(alt_usrlibdir)/libm.a || die
 		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
+			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
 	fi
 
 	# We configure toolchains for standalone prefix systems with a sysroot,
@@ -1650,7 +1656,8 @@ pkg_preinst() {
 	# bug #802207
 	if 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
+		cp -p "${EROOT}/$(get_libdir)/libcrypt$(get_libname 1)" \
+			"${T}/libcrypt$(get_libname 1)" || die
 	else
 		PRESERVED_OLD_LIBCRYPT=0
 	fi

diff --git a/sys-libs/glibc/glibc-2.39-r4.ebuild b/sys-libs/glibc/glibc-2.39-r4.ebuild
index 0033fe226b27..5d05b046a06e 100644
--- a/sys-libs/glibc/glibc-2.39-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r4.ebuild
@@ -9,14 +9,6 @@ EAPI=8
 PYTHON_COMPAT=( python3_{10..12} )
 TMPFILES_OPTIONAL=1
 
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
@@ -40,6 +32,12 @@ MIN_PAX_UTILS_VER="1.3.3"
 # its seccomp filter!). Please double check this!
 MIN_SYSTEMD_VER="254.9-r1"
 
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
@@ -51,6 +49,8 @@ fi
 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 )"
 
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
 IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
 
 # Here's how the cross-compile logic breaks down ...
@@ -213,7 +213,9 @@ XFAIL_NSPAWN_TEST_LIST=(
 dump_build_environment() {
 	einfo ==== glibc build environment ========================================================
 	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
+		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
+		STRINGS OBJDUMP READELF; do
 		einfo " $(printf '%15s' ${v}:)   ${!v}"
 	done
 	einfo =====================================================================================
@@ -256,7 +258,9 @@ alt_build_headers() {
 		if tc-is-cross-compiler ; then
 			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
 			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				local header_path=$(echo '#include <linux/version.h>' \
+					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
+					| grep -o '[^"]*linux/version.h')
 				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
 			fi
 		fi
@@ -1363,9 +1367,11 @@ glibc_do_src_install() {
 		# Move versioned .a file out of libdir to evade portage QA checks
 		# instead of using gen_usr_ldscript(). We fix ldscript as:
 		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
+			"${ED}"/$(alt_usrlibdir)/libm.a || die
 		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
+			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
 	fi
 
 	# We configure toolchains for standalone prefix systems with a sysroot,
@@ -1650,7 +1656,8 @@ pkg_preinst() {
 	# bug #802207
 	if 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
+		cp -p "${EROOT}/$(get_libdir)/libcrypt$(get_libname 1)" \
+			"${T}/libcrypt$(get_libname 1)" || die
 	else
 		PRESERVED_OLD_LIBCRYPT=0
 	fi

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index c3dce15e7e99..93936304f66f 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -9,14 +9,6 @@ EAPI=8
 PYTHON_COMPAT=( python3_{10..12} )
 TMPFILES_OPTIONAL=1
 
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
@@ -40,6 +32,12 @@ MIN_PAX_UTILS_VER="1.3.3"
 # its seccomp filter!). Please double check this!
 MIN_SYSTEMD_VER="254.9-r1"
 
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
@@ -51,6 +49,8 @@ fi
 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 )"
 
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
 IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
 
 # Here's how the cross-compile logic breaks down ...
@@ -213,7 +213,9 @@ XFAIL_NSPAWN_TEST_LIST=(
 dump_build_environment() {
 	einfo ==== glibc build environment ========================================================
 	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
+		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
+		STRINGS OBJDUMP READELF; do
 		einfo " $(printf '%15s' ${v}:)   ${!v}"
 	done
 	einfo =====================================================================================
@@ -256,7 +258,9 @@ alt_build_headers() {
 		if tc-is-cross-compiler ; then
 			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
 			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+				local header_path=$(echo '#include <linux/version.h>' \
+					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
+					| grep -o '[^"]*linux/version.h')
 				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
 			fi
 		fi
@@ -1363,9 +1367,11 @@ glibc_do_src_install() {
 		# Move versioned .a file out of libdir to evade portage QA checks
 		# instead of using gen_usr_ldscript(). We fix ldscript as:
 		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
+			"${ED}"/$(alt_usrlibdir)/libm.a || die
 		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
+			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
 	fi
 
 	# We configure toolchains for standalone prefix systems with a sysroot,
@@ -1650,7 +1656,8 @@ pkg_preinst() {
 	# bug #802207
 	if 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
+		cp -p "${EROOT}/$(get_libdir)/libcrypt$(get_libname 1)" \
+			"${T}/libcrypt$(get_libname 1)" || die
 	else
 		PRESERVED_OLD_LIBCRYPT=0
 	fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-04-30  5:54 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-04-30  5:54 UTC (permalink / raw
  To: gentoo-commits

commit:     cda927fb0d36cdb0563413cc92818dcf358dd0df
Author:     Matoro Mahri <matoro_gentoo <AT> matoro <DOT> tk>
AuthorDate: Fri Apr 26 03:48:40 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Apr 30 05:52:49 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cda927fb

sys-libs/glibc: skip tst-nice with nice 19

Fails otherwise, because it expects to see a change when bumping
niceness, but no change can be make when niceness is already at max.

Bug: https://bugs.gentoo.org/927238
Signed-off-by: Matoro Mahri <matoro_gentoo <AT> matoro.tk>
Closes: https://github.com/gentoo/gentoo/pull/36429
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r10.ebuild | 5 +++++
 sys-libs/glibc/glibc-2.38-r11.ebuild | 5 +++++
 sys-libs/glibc/glibc-2.38-r12.ebuild | 5 +++++
 sys-libs/glibc/glibc-2.38-r13.ebuild | 5 +++++
 sys-libs/glibc/glibc-2.39-r3.ebuild  | 5 +++++
 sys-libs/glibc/glibc-2.39-r4.ebuild  | 5 +++++
 sys-libs/glibc/glibc-9999.ebuild     | 5 +++++
 7 files changed, 35 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.38-r10.ebuild b/sys-libs/glibc/glibc-2.38-r10.ebuild
index 5fca93e98070..a60562d5f8ce 100644
--- a/sys-libs/glibc/glibc-2.38-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r10.ebuild
@@ -1266,6 +1266,11 @@ glibc_src_test() {
 			ewarn "Skipping extra tests because in systemd-nspawn container"
 			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
 		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
 
 		for myt in ${XFAIL_TEST_LIST[@]} ; do
 			myxfailparams+="test-xfail-${myt}=yes "

diff --git a/sys-libs/glibc/glibc-2.38-r11.ebuild b/sys-libs/glibc/glibc-2.38-r11.ebuild
index 93f0999d1d03..17e29f36c3fe 100644
--- a/sys-libs/glibc/glibc-2.38-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r11.ebuild
@@ -1272,6 +1272,11 @@ glibc_src_test() {
 			ewarn "Skipping extra tests because in systemd-nspawn container"
 			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
 		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
 
 		for myt in ${XFAIL_TEST_LIST[@]} ; do
 			myxfailparams+="test-xfail-${myt}=yes "

diff --git a/sys-libs/glibc/glibc-2.38-r12.ebuild b/sys-libs/glibc/glibc-2.38-r12.ebuild
index 9c1814df87de..3faaa1af693c 100644
--- a/sys-libs/glibc/glibc-2.38-r12.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r12.ebuild
@@ -1272,6 +1272,11 @@ glibc_src_test() {
 			ewarn "Skipping extra tests because in systemd-nspawn container"
 			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
 		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
 
 		for myt in ${XFAIL_TEST_LIST[@]} ; do
 			myxfailparams+="test-xfail-${myt}=yes "

diff --git a/sys-libs/glibc/glibc-2.38-r13.ebuild b/sys-libs/glibc/glibc-2.38-r13.ebuild
index 11905f8503e2..f8c587470c6d 100644
--- a/sys-libs/glibc/glibc-2.38-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r13.ebuild
@@ -1272,6 +1272,11 @@ glibc_src_test() {
 			ewarn "Skipping extra tests because in systemd-nspawn container"
 			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
 		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
 
 		for myt in ${XFAIL_TEST_LIST[@]} ; do
 			myxfailparams+="test-xfail-${myt}=yes "

diff --git a/sys-libs/glibc/glibc-2.39-r3.ebuild b/sys-libs/glibc/glibc-2.39-r3.ebuild
index 8a1b09f69a23..bfab9dd8ed28 100644
--- a/sys-libs/glibc/glibc-2.39-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r3.ebuild
@@ -1276,6 +1276,11 @@ glibc_src_test() {
 			ewarn "Skipping extra tests because in systemd-nspawn container"
 			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
 		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
 
 		for myt in ${XFAIL_TEST_LIST[@]} ; do
 			myxfailparams+="test-xfail-${myt}=yes "

diff --git a/sys-libs/glibc/glibc-2.39-r4.ebuild b/sys-libs/glibc/glibc-2.39-r4.ebuild
index 5d05b046a06e..8fe8030a9e56 100644
--- a/sys-libs/glibc/glibc-2.39-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r4.ebuild
@@ -1276,6 +1276,11 @@ glibc_src_test() {
 			ewarn "Skipping extra tests because in systemd-nspawn container"
 			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
 		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
 
 		for myt in ${XFAIL_TEST_LIST[@]} ; do
 			myxfailparams+="test-xfail-${myt}=yes "

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 93936304f66f..3a053a9de724 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1276,6 +1276,11 @@ glibc_src_test() {
 			ewarn "Skipping extra tests because in systemd-nspawn container"
 			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
 		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
 
 		for myt in ${XFAIL_TEST_LIST[@]} ; do
 			myxfailparams+="test-xfail-${myt}=yes "


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-01 23:18 Ionen Wolkens
  0 siblings, 0 replies; 1076+ messages in thread
From: Ionen Wolkens @ 2024-05-01 23:18 UTC (permalink / raw
  To: gentoo-commits

commit:     e194172dfbadeb045e1e598865215b6115315482
Author:     Matoro Mahri <matoro_gentoo <AT> matoro <DOT> tk>
AuthorDate: Wed May  1 20:42:00 2024 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Wed May  1 23:17:43 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e194172d

sys-libs/glibc: Stabilize 2.38-r13 arm, #930703

Signed-off-by: Matoro Mahri <matoro_gentoo <AT> matoro.tk>
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r13.ebuild b/sys-libs/glibc/glibc-2.38-r13.ebuild
index 2d462ff252c9..beddfe4b0def 100644
--- a/sys-libs/glibc/glibc-2.38-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r13.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-01 23:18 Ionen Wolkens
  0 siblings, 0 replies; 1076+ messages in thread
From: Ionen Wolkens @ 2024-05-01 23:18 UTC (permalink / raw
  To: gentoo-commits

commit:     bba061f01a6d6ef6a7bd584724f6fa1d67616663
Author:     Matoro Mahri <matoro_gentoo <AT> matoro <DOT> tk>
AuthorDate: Wed May  1 19:37:33 2024 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Wed May  1 23:17:43 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bba061f0

sys-libs/glibc: Stabilize 2.38-r13 x86, #930703

Signed-off-by: Matoro Mahri <matoro_gentoo <AT> matoro.tk>
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r13.ebuild b/sys-libs/glibc/glibc-2.38-r13.ebuild
index f8c587470c6d..2d462ff252c9 100644
--- a/sys-libs/glibc/glibc-2.38-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r13.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-01 23:48 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-05-01 23:48 UTC (permalink / raw
  To: gentoo-commits

commit:     ccd54d798b4e342c024b81de8701be5e746ed6d4
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed May  1 23:48:11 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed May  1 23:48:11 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ccd54d79

sys-libs/glibc: drop 2.38-r11, 2.39-r3

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    2 -
 sys-libs/glibc/glibc-2.38-r11.ebuild | 1729 ---------------------------------
 sys-libs/glibc/glibc-2.39-r3.ebuild  | 1736 ----------------------------------
 3 files changed, 3467 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 429274fcef77..9c56bef7ff7f 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -20,11 +20,9 @@ DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a59
 DIST glibc-2.37-patches-12.tar.xz 83716 BLAKE2B 123951d94dad6c22150c4ef2299bcaafc080322d6eeb58b49b0525a7f5c6867e99e96cd5c065578632d9a73b5527e2b2742bc29162da487894ecea6aff75df2e SHA512 b53c06e157b23f5fae1cd15eb90fdbf3076c79f295a687bdfd285689f94417267f167ff2d6a55c4d3c3b2e08dd6406c36fed4a5fee33378dd69976c1102c01a2
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-10.tar.xz 60792 BLAKE2B e228568f9e9cfa719ee9f2f91d220efa53e4eba617377fdf37bf7381b9f7c43036dfe62dd284b4228e9a99d41223ed0416ed058407a630b84064962518cba90b SHA512 573661299d75b63b7e2f771e9032193492e762e64cbb495b42bb7ad1021532f54f19d829a721e8070c79b2ad5edef077584cc4c76896d951cc93275592cf255c
-DIST glibc-2.38-patches-11.tar.xz 67188 BLAKE2B 5025fd72359842a357e7c2cd76de3e717c9bd117259dd8be93aa6fcd906f8b65e266388bf685e611bfa439d57c03e0a4f7d024d7a766ff275277936f76f1ecbf SHA512 d0fa1c11c153c7ada8668d865a15c7c47013956b5fa1e0d0e2b7e24cea5d3e16909dc8f9ba9b2b392d85271ed71603deb440ead19de50fd61b53a6c1f73d467b
 DIST glibc-2.38-patches-12.tar.xz 83568 BLAKE2B 051f32976d82cfe510084a94a4a40f328531eab8601454685c906405a96bb92527780378ccf6bfa42ab9cbadc405545d3bd28d0c4a15927d1a1c18a7a23c513f SHA512 a66d567680f5b34e35d1e4c5c2a4a9b0af67450cc0ea4a03074ec66953d79e4d0e9e921ca44717b3ca45f5910a8cdb033818bc111efd93b41666610cc8478b67
 DIST glibc-2.38-patches-13.tar.xz 92708 BLAKE2B b2f05a793c92ea0b7901d2124fcd968fa846fdf687f8cbdbc17795c33fae2d538133fae66d575c5b98a7a05a29f9f816e7ecd45f3be5ed10ef65adbf92c7fc4d SHA512 24e45a88fa7676ef22a7e2bb864dff27262f69900c4ef76d21c6fee498d728949b6f5d03dd094d1774a66a8a47b779bf4b16ee31e5306bcdb55cedcc0a1c5e9f
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
-DIST glibc-2.39-patches-3.tar.xz 69980 BLAKE2B 08239eb30c0059ea7ff750287f9349ebc4dff3416aa4711db2cdfedf5a01ba000e135b390528cc77e50c20cb2656aaa571c299542b495fe72828301f61702548 SHA512 47c87e568ce6bdddf42605d8c422869c238be13e77905051b214fed51265de0cd35c2031d0fc906019058f5a159b6b99ed52cb177450db2f710ce398770b3e85
 DIST glibc-2.39-patches-4.tar.xz 77228 BLAKE2B 64ead3c5f20092cde8ccd91692e556e412cfbe8ec22917db29a752ac9d8df2b1bcd20ce288253790ce391dcf82fcfec1f2a0895ae7d17842d45246d8d8881a6a SHA512 a84b76131a5c7c5c4d242dbefc124932a24177095a6447c715f9f8654cdd83190434d492c7ae3bf47b6e6eb717aae046b76647d653854add3d32e9e4b9fbefbe
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238

diff --git a/sys-libs/glibc/glibc-2.38-r11.ebuild b/sys-libs/glibc/glibc-2.38-r11.ebuild
deleted file mode 100644
index 17e29f36c3fe..000000000000
--- a/sys-libs/glibc/glibc-2.38-r11.ebuild
+++ /dev/null
@@ -1,1729 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..12} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=11
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# - similarly, valgrind requires knowledge about symbols in ld.so:
-#	bug #920753
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
-	tst-sched1
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-	export glibc__ORIG_CPP=${CPP}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		export CXX="${current_gcc_path}/g++"
-		export CPP="$(tc-getCPP ${CTARGET})"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-	export glibc__GLIBC_CPP=${CPP}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-		if [[ "$(nice)" == "19" ]] ; then
-			# Expects to be able to increase niceness, which it can't do if
-			# already at the highest nice value
-			XFAIL_TEST_LIST+=( "tst-nice" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# we give the tests a bit more time to avoid spurious
-	# bug reports on slow arches
-
-	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	# valgrind requires knowledge about ld.so symbols.
-	dostrip -x $(alt_libdir)/ld-*.so*
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.39-r3.ebuild b/sys-libs/glibc/glibc-2.39-r3.ebuild
deleted file mode 100644
index bfab9dd8ed28..000000000000
--- a/sys-libs/glibc/glibc-2.39-r3.ebuild
+++ /dev/null
@@ -1,1736 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..12} )
-TMPFILES_OPTIONAL=1
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=3
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-# Minimum systemd version needed (which contains any new syscall changes for
-# its seccomp filter!). Please double check this!
-MIN_SYSTEMD_VER="254.9-r1"
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 )"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# - similarly, valgrind requires knowledge about symbols in ld.so:
-#	bug #920753
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-
-	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
-	tst-sched1
-
-	# Fails regularly, unreliable
-	tst-valgrind-smoke
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
-		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
-		STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' \
-					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
-					| grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if ! use cet; then
-		if use amd64 || use x86; then
-			append-flags '-fcf-protection=none'
-		elif use arm64; then
-			append-flags '-mbranch-protection=none'
-		fi
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-	export glibc__ORIG_CPP=${CPP}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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})"
-		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-	export glibc__GLIBC_CPP=${CPP}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	case ${ABI}-${CTARGET} in
-		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-		if [[ "$(nice)" == "19" ]] ; then
-			# Expects to be able to increase niceness, which it can't do if
-			# already at the highest nice value
-			XFAIL_TEST_LIST+=( "tst-nice" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	# valgrind requires knowledge about ld.so symbols.
-	dostrip -x $(alt_libdir)/ld-*.so*
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
-			"${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
-			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-04 12:00 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-05-04 12:00 UTC (permalink / raw
  To: gentoo-commits

commit:     55d156e2b09750d7d3b03a5e32a65c6577128629
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat May  4 11:59:28 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat May  4 11:59:28 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=55d156e2

sys-libs/glibc: Stabilize 2.38-r13 sparc, #930703

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r13.ebuild b/sys-libs/glibc/glibc-2.38-r13.ebuild
index bb9afc171400..1de5a90ac29b 100644
--- a/sys-libs/glibc/glibc-2.38-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r13.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-04 12:00 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-05-04 12:00 UTC (permalink / raw
  To: gentoo-commits

commit:     cd30573cabbaafd2fa37ac9f6dd00eb1b8b90965
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat May  4 11:59:25 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat May  4 11:59:25 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cd30573c

sys-libs/glibc: Stabilize 2.38-r13 hppa, #930703

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r13.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.38-r13.ebuild b/sys-libs/glibc/glibc-2.38-r13.ebuild
index beddfe4b0def..bb9afc171400 100644
--- a/sys-libs/glibc/glibc-2.38-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r13.ebuild
@@ -39,7 +39,7 @@ MIN_PAX_UTILS_VER="1.3.3"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-04 13:58 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-05-04 13:58 UTC (permalink / raw
  To: gentoo-commits

commit:     04c79924d908c63a294bb4d6d1f7e4c99eba5a2d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat May  4 13:56:49 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat May  4 13:58:01 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04c79924

sys-libs/glibc: add 2.39 patchset 5

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.39-r5.ebuild | 1736 +++++++++++++++++++++++++++++++++++
 2 files changed, 1737 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 9c56bef7ff7f..9f0b88d991bd 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -24,6 +24,7 @@ DIST glibc-2.38-patches-12.tar.xz 83568 BLAKE2B 051f32976d82cfe510084a94a4a40f32
 DIST glibc-2.38-patches-13.tar.xz 92708 BLAKE2B b2f05a793c92ea0b7901d2124fcd968fa846fdf687f8cbdbc17795c33fae2d538133fae66d575c5b98a7a05a29f9f816e7ecd45f3be5ed10ef65adbf92c7fc4d SHA512 24e45a88fa7676ef22a7e2bb864dff27262f69900c4ef76d21c6fee498d728949b6f5d03dd094d1774a66a8a47b779bf4b16ee31e5306bcdb55cedcc0a1c5e9f
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-2.39-patches-4.tar.xz 77228 BLAKE2B 64ead3c5f20092cde8ccd91692e556e412cfbe8ec22917db29a752ac9d8df2b1bcd20ce288253790ce391dcf82fcfec1f2a0895ae7d17842d45246d8d8881a6a SHA512 a84b76131a5c7c5c4d242dbefc124932a24177095a6447c715f9f8654cdd83190434d492c7ae3bf47b6e6eb717aae046b76647d653854add3d32e9e4b9fbefbe
+DIST glibc-2.39-patches-5.tar.xz 84460 BLAKE2B 38fa4fea4e5f40050aff49067bce9910e394e3b6c261c94fc1beab1838b29c54de74127771644b1da745480c0af481aa3898ef5bcdf278aa568d12d92c262deb SHA512 461c8c82276df52c65008f7be90a365504e2720e39861726aa11dc4cd6ea1c90c9286ba6df647f5f1decf9f6cd7b6bc478efbeec0f69181404a3b33f33a73b69
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.39-r5.ebuild b/sys-libs/glibc/glibc-2.39-r5.ebuild
new file mode 100644
index 000000000000..b2f0a7c469fb
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.39-r5.ebuild
@@ -0,0 +1,1736 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=5
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+# Minimum systemd version needed (which contains any new syscall changes for
+# its seccomp filter!). Please double check this!
+MIN_SYSTEMD_VER="254.9-r1"
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 )"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+
+	# Fails regularly, unreliable
+	tst-valgrind-smoke
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
+		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
+		STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' \
+					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
+					| grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+		# Lock glibc at -O2; we want to be conservative here.
+		filter-flags '-O?'
+		append-flags -O2
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if ! use cet; then
+		if use amd64 || use x86; then
+			append-flags '-fcf-protection=none'
+		elif use arm64; then
+			append-flags '-mbranch-protection=none'
+		fi
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP=${CPP}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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})"
+		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	case ${ABI}-${CTARGET} in
+		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
+			"${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
+			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-04 13:59 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-05-04 13:59 UTC (permalink / raw
  To: gentoo-commits

commit:     1e771e067e2d92cd76358f2cd100bf05076cfec4
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat May  4 13:59:09 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat May  4 13:59:09 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1e771e06

sys-libs/glibc: drop 2.38-r10, 2.38-r12

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.38-r10.ebuild | 1723 ---------------------------------
 sys-libs/glibc/glibc-2.38-r12.ebuild | 1729 ----------------------------------
 2 files changed, 3452 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.38-r10.ebuild b/sys-libs/glibc/glibc-2.38-r10.ebuild
deleted file mode 100644
index a60562d5f8ce..000000000000
--- a/sys-libs/glibc/glibc-2.38-r10.ebuild
+++ /dev/null
@@ -1,1723 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..12} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=10
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# - similarly, valgrind requires knowledge about symbols in ld.so:
-#	bug #920753
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
-	tst-sched1
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-		if [[ "$(nice)" == "19" ]] ; then
-			# Expects to be able to increase niceness, which it can't do if
-			# already at the highest nice value
-			XFAIL_TEST_LIST+=( "tst-nice" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# we give the tests a bit more time to avoid spurious
-	# bug reports on slow arches
-
-	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	# valgrind requires knowledge about ld.so symbols.
-	dostrip -x $(alt_libdir)/ld-*.so*
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.38-r12.ebuild b/sys-libs/glibc/glibc-2.38-r12.ebuild
deleted file mode 100644
index 3faaa1af693c..000000000000
--- a/sys-libs/glibc/glibc-2.38-r12.ebuild
+++ /dev/null
@@ -1,1729 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..12} )
-TMPFILES_OPTIONAL=1
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=12
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# - similarly, valgrind requires knowledge about symbols in ld.so:
-#	bug #920753
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
-	tst-sched1
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if (use amd64 || use x86) && ! use cet; then
-		append-flags '-fcf-protection=none'
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-	export glibc__ORIG_CPP=${CPP}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		export CXX="${current_gcc_path}/g++"
-		export CPP="$(tc-getCPP ${CTARGET})"
-		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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-	export glibc__GLIBC_CPP=${CPP}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	# Enable Intel Control-flow Enforcement Technology on amd64 if requested
-	case ${CTARGET} in
-		x86_64-*) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_enable crypt)
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# ia64 static cross-compilers are a pita in so much that they
-	# can't produce static ELFs (as the libgcc.a is broken).  so
-	# disable building of the programs for those targets if it
-	# doesn't work.
-	# XXX: We could turn this into a compiler test, but ia64 is
-	# the only one that matters, so this should be fine for now.
-	if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-		sed -i '1i+link-static = touch $@' config.make
-	fi
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--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}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-		if [[ "$(nice)" == "19" ]] ; then
-			# Expects to be able to increase niceness, which it can't do if
-			# already at the highest nice value
-			XFAIL_TEST_LIST+=( "tst-nice" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# we give the tests a bit more time to avoid spurious
-	# bug reports on slow arches
-
-	SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=32 emake ${myxfailparams} check
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	# valgrind requires knowledge about ld.so symbols.
-	dostrip -x $(alt_libdir)/ld-*.so*
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-04 14:10 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-05-04 14:10 UTC (permalink / raw
  To: gentoo-commits

commit:     e42cc3ffadab6927bbd2dbab1465119833f3d893
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat May  4 14:10:15 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat May  4 14:10:15 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e42cc3ff

sys-libs/glibc: fix Manifest

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 9f0b88d991bd..ebb82251aabe 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -19,8 +19,6 @@ DIST glibc-2.36-patches-10.tar.xz 118268 BLAKE2B 3d1bdb6c1a9e10ba78a344ca8940f68
 DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e
 DIST glibc-2.37-patches-12.tar.xz 83716 BLAKE2B 123951d94dad6c22150c4ef2299bcaafc080322d6eeb58b49b0525a7f5c6867e99e96cd5c065578632d9a73b5527e2b2742bc29162da487894ecea6aff75df2e SHA512 b53c06e157b23f5fae1cd15eb90fdbf3076c79f295a687bdfd285689f94417267f167ff2d6a55c4d3c3b2e08dd6406c36fed4a5fee33378dd69976c1102c01a2
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
-DIST glibc-2.38-patches-10.tar.xz 60792 BLAKE2B e228568f9e9cfa719ee9f2f91d220efa53e4eba617377fdf37bf7381b9f7c43036dfe62dd284b4228e9a99d41223ed0416ed058407a630b84064962518cba90b SHA512 573661299d75b63b7e2f771e9032193492e762e64cbb495b42bb7ad1021532f54f19d829a721e8070c79b2ad5edef077584cc4c76896d951cc93275592cf255c
-DIST glibc-2.38-patches-12.tar.xz 83568 BLAKE2B 051f32976d82cfe510084a94a4a40f328531eab8601454685c906405a96bb92527780378ccf6bfa42ab9cbadc405545d3bd28d0c4a15927d1a1c18a7a23c513f SHA512 a66d567680f5b34e35d1e4c5c2a4a9b0af67450cc0ea4a03074ec66953d79e4d0e9e921ca44717b3ca45f5910a8cdb033818bc111efd93b41666610cc8478b67
 DIST glibc-2.38-patches-13.tar.xz 92708 BLAKE2B b2f05a793c92ea0b7901d2124fcd968fa846fdf687f8cbdbc17795c33fae2d538133fae66d575c5b98a7a05a29f9f816e7ecd45f3be5ed10ef65adbf92c7fc4d SHA512 24e45a88fa7676ef22a7e2bb864dff27262f69900c4ef76d21c6fee498d728949b6f5d03dd094d1774a66a8a47b779bf4b16ee31e5306bcdb55cedcc0a1c5e9f
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-2.39-patches-4.tar.xz 77228 BLAKE2B 64ead3c5f20092cde8ccd91692e556e412cfbe8ec22917db29a752ac9d8df2b1bcd20ce288253790ce391dcf82fcfec1f2a0895ae7d17842d45246d8d8881a6a SHA512 a84b76131a5c7c5c4d242dbefc124932a24177095a6447c715f9f8654cdd83190434d492c7ae3bf47b6e6eb717aae046b76647d653854add3d32e9e4b9fbefbe


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-05  1:14 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-05-05  1:14 UTC (permalink / raw
  To: gentoo-commits

commit:     36dfe7f91283c5208113041c0e460bec361e43c6
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun May  5 01:13:53 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun May  5 01:13:53 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=36dfe7f9

sys-libs/glibc: keyword 2.39-r5

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r5.ebuild b/sys-libs/glibc/glibc-2.39-r5.ebuild
index b2f0a7c469fb..26b5a207975e 100644
--- a/sys-libs/glibc/glibc-2.39-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r5.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-06  5:28 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-05-06  5:28 UTC (permalink / raw
  To: gentoo-commits

commit:     2db1831deae8eadfb7e92d13cb2540c6916b1155
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon May  6 05:27:34 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon May  6 05:28:21 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2db1831d

sys-libs/glibc: allow -O3

After 0fdf4ba48ccce5abf567340b0ab8fa8ed8a9bc6e, 5a2cf833f5772d6c37c7adac388dd9af9cc1c4b9,
and ded2e0753e9c46debeb2e0d26c5e560d2581d314 upstream, glibc builds fine
with -O3 on amd64. Allow that too.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r5.ebuild | 11 ++++++++---
 sys-libs/glibc/glibc-9999.ebuild    | 11 ++++++++---
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.39-r5.ebuild b/sys-libs/glibc/glibc-2.39-r5.ebuild
index 26b5a207975e..8d816148ab46 100644
--- a/sys-libs/glibc/glibc-2.39-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r5.ebuild
@@ -447,9 +447,14 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
+
+		# Allow -O2 and -O3, but nothing else for now.
+		# TODO: Test -Os, -Oz.
+		if ! is-flagq '-O@(2|3)' ; then
+			# Lock glibc at -O2. We want to be conservative here.
+			filter-flags '-O?'
+			append-flags -O2
+		fi
 	fi
 
 	strip-unsupported-flags

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 3a053a9de724..0cbc0a06f45e 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -447,9 +447,14 @@ setup_flags() {
 		# relating to failed builds, we strip most CFLAGS out to ensure as few
 		# problems as possible.
 		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
+
+		# Allow -O2 and -O3, but nothing else for now.
+		# TODO: Test -Os, -Oz.
+		if ! is-flagq '-O@(2|3)' ; then
+			# Lock glibc at -O2. We want to be conservative here.
+			filter-flags '-O?'
+			append-flags -O2
+		fi
 	fi
 
 	strip-unsupported-flags


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-11  1:42 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-05-11  1:42 UTC (permalink / raw
  To: gentoo-commits

commit:     69997e9d68aa35cb34f855a267f1efa18469a3f3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat May 11 01:41:53 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat May 11 01:41:53 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=69997e9d

sys-libs/glibc: fix -Wimplicit-int in multilib-bootstrap check

-Wimplicit-int becomes an error by default in newer compilers.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r3.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.31-r7.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.32-r8.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.33-r14.ebuild | 2 +-
 sys-libs/glibc/glibc-2.34-r14.ebuild | 2 +-
 sys-libs/glibc/glibc-2.35-r11.ebuild | 2 +-
 sys-libs/glibc/glibc-2.36-r8.ebuild  | 2 +-
 sys-libs/glibc/glibc-2.37-r10.ebuild | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r3.ebuild b/sys-libs/glibc/glibc-2.19-r3.ebuild
index 692c93b9e4cd..4098211ce0aa 100644
--- a/sys-libs/glibc/glibc-2.19-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r3.ebuild
@@ -887,7 +887,7 @@ glibc_do_configure() {
 	# add x32 to it, gcc/glibc don't yet support x32.
 	#
 	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
+		echo 'int main(){}' > "${T}"/test.c
 		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
 			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
 		fi

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index b9666e9e7e59..2625a376cfa0 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -979,7 +979,7 @@ glibc_do_configure() {
 	# add x32 to it, gcc/glibc don't yet support x32.
 	#
 	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
+		echo 'int main(){}' > "${T}"/test.c
 		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
 			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
 		fi

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index c2a242aa11ed..977997ef0840 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -1008,7 +1008,7 @@ glibc_do_configure() {
 	# add x32 to it, gcc/glibc don't yet support x32.
 	#
 	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
-		echo 'main(){}' > "${T}"/test.c
+		echo 'int main(){}' > "${T}"/test.c
 		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
 			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
 		fi

diff --git a/sys-libs/glibc/glibc-2.33-r14.ebuild b/sys-libs/glibc/glibc-2.33-r14.ebuild
index c9d2f2586f87..a9012e350120 100644
--- a/sys-libs/glibc/glibc-2.33-r14.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r14.ebuild
@@ -1029,7 +1029,7 @@ glibc_do_configure() {
 	# add x32 to it, gcc/glibc don't yet support x32.
 	#
 	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
+		echo 'int main(){}' > "${T}"/test.c
 		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
 			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
 		fi

diff --git a/sys-libs/glibc/glibc-2.34-r14.ebuild b/sys-libs/glibc/glibc-2.34-r14.ebuild
index e0d9f9970c12..9d92b5e3783f 100644
--- a/sys-libs/glibc/glibc-2.34-r14.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r14.ebuild
@@ -1050,7 +1050,7 @@ glibc_do_configure() {
 	# add x32 to it, gcc/glibc don't yet support x32.
 	#
 	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
+		echo 'int main(){}' > "${T}"/test.c
 		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
 			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
 		fi

diff --git a/sys-libs/glibc/glibc-2.35-r11.ebuild b/sys-libs/glibc/glibc-2.35-r11.ebuild
index 57474eb0373f..86a7d2673b22 100644
--- a/sys-libs/glibc/glibc-2.35-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r11.ebuild
@@ -1056,7 +1056,7 @@ glibc_do_configure() {
 	# add x32 to it, gcc/glibc don't yet support x32.
 	#
 	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
+		echo 'int main(){}' > "${T}"/test.c
 		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
 			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
 		fi

diff --git a/sys-libs/glibc/glibc-2.36-r8.ebuild b/sys-libs/glibc/glibc-2.36-r8.ebuild
index fe8428a2490e..caac3e58f9b6 100644
--- a/sys-libs/glibc/glibc-2.36-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r8.ebuild
@@ -1086,7 +1086,7 @@ glibc_do_configure() {
 	# add x32 to it, gcc/glibc don't yet support x32.
 	#
 	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
+		echo 'int main(){}' > "${T}"/test.c
 		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
 			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
 		fi

diff --git a/sys-libs/glibc/glibc-2.37-r10.ebuild b/sys-libs/glibc/glibc-2.37-r10.ebuild
index 053cfe2b0f85..53335dbbd2f7 100644
--- a/sys-libs/glibc/glibc-2.37-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r10.ebuild
@@ -1097,7 +1097,7 @@ glibc_do_configure() {
 	# add x32 to it, gcc/glibc don't yet support x32.
 	#
 	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'main(){}' > "${T}"/test.c
+		echo 'int main(){}' > "${T}"/test.c
 		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
 			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
 		fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-12 10:26 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-05-12 10:26 UTC (permalink / raw
  To: gentoo-commits

commit:     1d73ad7501ff2493d151e25f9c1eb1ab2f382f03
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun May 12 10:25:12 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun May 12 10:25:49 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1d73ad75

sys-libs/glibc: add 2.39 patchlevel 6 (minor but helpful)

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.39-r6.ebuild | 1741 +++++++++++++++++++++++++++++++++++
 2 files changed, 1742 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index ebb82251aabe..e41feccf00d2 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -23,6 +23,7 @@ DIST glibc-2.38-patches-13.tar.xz 92708 BLAKE2B b2f05a793c92ea0b7901d2124fcd968f
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-2.39-patches-4.tar.xz 77228 BLAKE2B 64ead3c5f20092cde8ccd91692e556e412cfbe8ec22917db29a752ac9d8df2b1bcd20ce288253790ce391dcf82fcfec1f2a0895ae7d17842d45246d8d8881a6a SHA512 a84b76131a5c7c5c4d242dbefc124932a24177095a6447c715f9f8654cdd83190434d492c7ae3bf47b6e6eb717aae046b76647d653854add3d32e9e4b9fbefbe
 DIST glibc-2.39-patches-5.tar.xz 84460 BLAKE2B 38fa4fea4e5f40050aff49067bce9910e394e3b6c261c94fc1beab1838b29c54de74127771644b1da745480c0af481aa3898ef5bcdf278aa568d12d92c262deb SHA512 461c8c82276df52c65008f7be90a365504e2720e39861726aa11dc4cd6ea1c90c9286ba6df647f5f1decf9f6cd7b6bc478efbeec0f69181404a3b33f33a73b69
+DIST glibc-2.39-patches-6.tar.xz 87600 BLAKE2B 7bb24a16fb64ed07a7477dad075dfedd59ab8d0d4ab3032273684405fd690a863a84fe1f859a07faab3ccd4663ba4f896ca37303cf2a4658ab1662732c50e860 SHA512 d48de19e9e33ef334cdbd63b6ceaddff12424477193f6bb0876105e193f2aba44cb48c33aebc47546db76dc229849cc22f884a68971bbc23994769b64bcd345c
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.39-r6.ebuild b/sys-libs/glibc/glibc-2.39-r6.ebuild
new file mode 100644
index 000000000000..ef30b59bd8e3
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.39-r6.ebuild
@@ -0,0 +1,1741 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=6
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+# Minimum systemd version needed (which contains any new syscall changes for
+# its seccomp filter!). Please double check this!
+MIN_SYSTEMD_VER="254.9-r1"
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 )"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+
+	# Fails regularly, unreliable
+	tst-valgrind-smoke
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
+		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
+		STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' \
+					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
+					| grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+
+		# Allow -O2 and -O3, but nothing else for now.
+		# TODO: Test -Os, -Oz.
+		if ! is-flagq '-O@(2|3)' ; then
+			# Lock glibc at -O2. We want to be conservative here.
+			filter-flags '-O?'
+			append-flags -O2
+		fi
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if ! use cet; then
+		if use amd64 || use x86; then
+			append-flags '-fcf-protection=none'
+		elif use arm64; then
+			append-flags '-mbranch-protection=none'
+		fi
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP=${CPP}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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})"
+		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	case ${ABI}-${CTARGET} in
+		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
+			"${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
+			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-12 14:28 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-05-12 14:28 UTC (permalink / raw
  To: gentoo-commits

commit:     3a0ca0d9f58fb198073a8a30469a1e1eab156b08
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun May 12 14:27:24 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun May 12 14:27:58 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3a0ca0d9

sys-libs/glibc: keyword 2.39-r6

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r6.ebuild b/sys-libs/glibc/glibc-2.39-r6.ebuild
index ef30b59bd8e3..b65dd98d7eda 100644
--- a/sys-libs/glibc/glibc-2.39-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r6.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-14 14:36 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-05-14 14:36 UTC (permalink / raw
  To: gentoo-commits

commit:     1df9b3482f2e199390ecbe04a76f5397e450218f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue May 14 14:34:45 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue May 14 14:34:45 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1df9b348

sys-libs/glibc: drop 2.39-r4, 2.39-r5

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    2 -
 sys-libs/glibc/glibc-2.39-r4.ebuild | 1736 ----------------------------------
 sys-libs/glibc/glibc-2.39-r5.ebuild | 1741 -----------------------------------
 3 files changed, 3479 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index e41feccf00d2..e09e9b7900b7 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -21,8 +21,6 @@ DIST glibc-2.37-patches-12.tar.xz 83716 BLAKE2B 123951d94dad6c22150c4ef2299bcaaf
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-13.tar.xz 92708 BLAKE2B b2f05a793c92ea0b7901d2124fcd968fa846fdf687f8cbdbc17795c33fae2d538133fae66d575c5b98a7a05a29f9f816e7ecd45f3be5ed10ef65adbf92c7fc4d SHA512 24e45a88fa7676ef22a7e2bb864dff27262f69900c4ef76d21c6fee498d728949b6f5d03dd094d1774a66a8a47b779bf4b16ee31e5306bcdb55cedcc0a1c5e9f
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
-DIST glibc-2.39-patches-4.tar.xz 77228 BLAKE2B 64ead3c5f20092cde8ccd91692e556e412cfbe8ec22917db29a752ac9d8df2b1bcd20ce288253790ce391dcf82fcfec1f2a0895ae7d17842d45246d8d8881a6a SHA512 a84b76131a5c7c5c4d242dbefc124932a24177095a6447c715f9f8654cdd83190434d492c7ae3bf47b6e6eb717aae046b76647d653854add3d32e9e4b9fbefbe
-DIST glibc-2.39-patches-5.tar.xz 84460 BLAKE2B 38fa4fea4e5f40050aff49067bce9910e394e3b6c261c94fc1beab1838b29c54de74127771644b1da745480c0af481aa3898ef5bcdf278aa568d12d92c262deb SHA512 461c8c82276df52c65008f7be90a365504e2720e39861726aa11dc4cd6ea1c90c9286ba6df647f5f1decf9f6cd7b6bc478efbeec0f69181404a3b33f33a73b69
 DIST glibc-2.39-patches-6.tar.xz 87600 BLAKE2B 7bb24a16fb64ed07a7477dad075dfedd59ab8d0d4ab3032273684405fd690a863a84fe1f859a07faab3ccd4663ba4f896ca37303cf2a4658ab1662732c50e860 SHA512 d48de19e9e33ef334cdbd63b6ceaddff12424477193f6bb0876105e193f2aba44cb48c33aebc47546db76dc229849cc22f884a68971bbc23994769b64bcd345c
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238

diff --git a/sys-libs/glibc/glibc-2.39-r4.ebuild b/sys-libs/glibc/glibc-2.39-r4.ebuild
deleted file mode 100644
index 8fe8030a9e56..000000000000
--- a/sys-libs/glibc/glibc-2.39-r4.ebuild
+++ /dev/null
@@ -1,1736 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..12} )
-TMPFILES_OPTIONAL=1
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=4
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-# Minimum systemd version needed (which contains any new syscall changes for
-# its seccomp filter!). Please double check this!
-MIN_SYSTEMD_VER="254.9-r1"
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 )"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# - similarly, valgrind requires knowledge about symbols in ld.so:
-#	bug #920753
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-
-	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
-	tst-sched1
-
-	# Fails regularly, unreliable
-	tst-valgrind-smoke
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
-		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
-		STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' \
-					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
-					| grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-		# Lock glibc at -O2; we want to be conservative here.
-		filter-flags '-O?'
-		append-flags -O2
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if ! use cet; then
-		if use amd64 || use x86; then
-			append-flags '-fcf-protection=none'
-		elif use arm64; then
-			append-flags '-mbranch-protection=none'
-		fi
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-	export glibc__ORIG_CPP=${CPP}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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})"
-		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-	export glibc__GLIBC_CPP=${CPP}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	case ${ABI}-${CTARGET} in
-		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-		if [[ "$(nice)" == "19" ]] ; then
-			# Expects to be able to increase niceness, which it can't do if
-			# already at the highest nice value
-			XFAIL_TEST_LIST+=( "tst-nice" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	# valgrind requires knowledge about ld.so symbols.
-	dostrip -x $(alt_libdir)/ld-*.so*
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
-			"${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
-			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.39-r5.ebuild b/sys-libs/glibc/glibc-2.39-r5.ebuild
deleted file mode 100644
index 8d816148ab46..000000000000
--- a/sys-libs/glibc/glibc-2.39-r5.ebuild
+++ /dev/null
@@ -1,1741 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..12} )
-TMPFILES_OPTIONAL=1
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=5
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-# Minimum systemd version needed (which contains any new syscall changes for
-# its seccomp filter!). Please double check this!
-MIN_SYSTEMD_VER="254.9-r1"
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 )"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# - similarly, valgrind requires knowledge about symbols in ld.so:
-#	bug #920753
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-
-	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
-	tst-sched1
-
-	# Fails regularly, unreliable
-	tst-valgrind-smoke
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
-		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
-		STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' \
-					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
-					| grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-
-		# Allow -O2 and -O3, but nothing else for now.
-		# TODO: Test -Os, -Oz.
-		if ! is-flagq '-O@(2|3)' ; then
-			# Lock glibc at -O2. We want to be conservative here.
-			filter-flags '-O?'
-			append-flags -O2
-		fi
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if ! use cet; then
-		if use amd64 || use x86; then
-			append-flags '-fcf-protection=none'
-		elif use arm64; then
-			append-flags '-mbranch-protection=none'
-		fi
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-	export glibc__ORIG_CPP=${CPP}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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})"
-		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-	export glibc__GLIBC_CPP=${CPP}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	case ${ABI}-${CTARGET} in
-		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-		if [[ "$(nice)" == "19" ]] ; then
-			# Expects to be able to increase niceness, which it can't do if
-			# already at the highest nice value
-			XFAIL_TEST_LIST+=( "tst-nice" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	# valgrind requires knowledge about ld.so symbols.
-	dostrip -x $(alt_libdir)/ld-*.so*
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
-			"${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
-			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-17 14:59 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-05-17 14:59 UTC (permalink / raw
  To: gentoo-commits

commit:     89257b5cd59f709e93313f51101b8fa32b20dba3
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri May 17 14:59:20 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri May 17 14:59:20 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=89257b5c

sys-libs/glibc: Stabilize 2.39-r6 ppc64, #932094

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r6.ebuild b/sys-libs/glibc/glibc-2.39-r6.ebuild
index b65dd98d7eda..7353ffff83ac 100644
--- a/sys-libs/glibc/glibc-2.39-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r6.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-17 14:59 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-05-17 14:59 UTC (permalink / raw
  To: gentoo-commits

commit:     75722b9c0d473728b063e1120e05121a92750f6f
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri May 17 14:59:21 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri May 17 14:59:21 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=75722b9c

sys-libs/glibc: Stabilize 2.39-r6 ppc, #932094

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r6.ebuild b/sys-libs/glibc/glibc-2.39-r6.ebuild
index 7353ffff83ac..2b8153ec82e7 100644
--- a/sys-libs/glibc/glibc-2.39-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r6.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-17 16:01 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-05-17 16:01 UTC (permalink / raw
  To: gentoo-commits

commit:     f8a6f4256a97a5a1f0c326feb5923505b4771db2
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri May 17 16:01:03 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 17 16:01:03 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8a6f425

sys-libs/glibc: Stabilize 2.39-r6 x86, #932094

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r6.ebuild b/sys-libs/glibc/glibc-2.39-r6.ebuild
index 2b8153ec82e7..d9db54b39710 100644
--- a/sys-libs/glibc/glibc-2.39-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r6.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-17 18:26 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-05-17 18:26 UTC (permalink / raw
  To: gentoo-commits

commit:     d019027c772df2a6e8f8c68a574e3f223afbf11f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri May 17 18:25:44 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 17 18:25:44 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d019027c

sys-libs/glibc: Stabilize 2.39-r6 amd64, #932094

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r6.ebuild b/sys-libs/glibc/glibc-2.39-r6.ebuild
index d9db54b39710..95872bdbbb24 100644
--- a/sys-libs/glibc/glibc-2.39-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r6.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-19 17:37 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-05-19 17:37 UTC (permalink / raw
  To: gentoo-commits

commit:     3ce948f8addbfcebeb7d5c721a75ea0c1e0866aa
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun May 19 17:37:01 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun May 19 17:37:01 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ce948f8

sys-libs/glibc: Stabilize 2.39-r6 arm64, #932094

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r6.ebuild b/sys-libs/glibc/glibc-2.39-r6.ebuild
index 95872bdbbb24..c360c6cb921a 100644
--- a/sys-libs/glibc/glibc-2.39-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r6.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa -ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-25 19:03 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-05-25 19:03 UTC (permalink / raw
  To: gentoo-commits

commit:     fefdfd676c9757761f4c45bd0bee91cb301feb9a
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat May 25 19:02:51 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat May 25 19:02:51 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fefdfd67

sys-libs/glibc: Stabilize 2.39-r6 sparc, #932094

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r6.ebuild b/sys-libs/glibc/glibc-2.39-r6.ebuild
index 1d713fcf6264..6772a8cdcc8b 100644
--- a/sys-libs/glibc/glibc-2.39-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r6.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa -ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa -ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-25 19:03 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-05-25 19:03 UTC (permalink / raw
  To: gentoo-commits

commit:     3d948ce02e5989bd68847a291580924aea622665
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat May 25 19:02:48 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat May 25 19:02:48 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d948ce0

sys-libs/glibc: Stabilize 2.39-r6 arm, #932094

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r6.ebuild b/sys-libs/glibc/glibc-2.39-r6.ebuild
index c360c6cb921a..1d713fcf6264 100644
--- a/sys-libs/glibc/glibc-2.39-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r6.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa -ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa -ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-29 22:46 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-05-29 22:46 UTC (permalink / raw
  To: gentoo-commits

commit:     ee5326032264788d35bf47e1600a423c02c8d468
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed May 29 22:45:47 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed May 29 22:46:33 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee532603

sys-libs/glibc: add 2.39 patchlevel 7

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.39-r7.ebuild | 1741 +++++++++++++++++++++++++++++++++++
 2 files changed, 1742 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index e09e9b7900b7..ed8f6e58de43 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -22,6 +22,7 @@ DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb8
 DIST glibc-2.38-patches-13.tar.xz 92708 BLAKE2B b2f05a793c92ea0b7901d2124fcd968fa846fdf687f8cbdbc17795c33fae2d538133fae66d575c5b98a7a05a29f9f816e7ecd45f3be5ed10ef65adbf92c7fc4d SHA512 24e45a88fa7676ef22a7e2bb864dff27262f69900c4ef76d21c6fee498d728949b6f5d03dd094d1774a66a8a47b779bf4b16ee31e5306bcdb55cedcc0a1c5e9f
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-2.39-patches-6.tar.xz 87600 BLAKE2B 7bb24a16fb64ed07a7477dad075dfedd59ab8d0d4ab3032273684405fd690a863a84fe1f859a07faab3ccd4663ba4f896ca37303cf2a4658ab1662732c50e860 SHA512 d48de19e9e33ef334cdbd63b6ceaddff12424477193f6bb0876105e193f2aba44cb48c33aebc47546db76dc229849cc22f884a68971bbc23994769b64bcd345c
+DIST glibc-2.39-patches-7.tar.xz 104640 BLAKE2B 9dba666c20aa4f4dde29fcc7173e53f08037102d0e53634533ac900f90d99a76f0f26064f6f71c72c75fa788f501e562a9f9548ebb44ded26ec55a5344e99d1e SHA512 214bf3256177141e059531775ed74d813a01a1e4f15892c40f7e70d8b26ce79216501d1cee5e6e980fbb5c2966ce427edf3136283486ae50acb88cb8e647ee0a
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.39-r7.ebuild b/sys-libs/glibc/glibc-2.39-r7.ebuild
new file mode 100644
index 000000000000..400ff741123b
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.39-r7.ebuild
@@ -0,0 +1,1741 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=7
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+# Minimum systemd version needed (which contains any new syscall changes for
+# its seccomp filter!). Please double check this!
+MIN_SYSTEMD_VER="254.9-r1"
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 )"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+
+	# Fails regularly, unreliable
+	tst-valgrind-smoke
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
+		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
+		STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' \
+					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
+					| grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+
+		# Allow -O2 and -O3, but nothing else for now.
+		# TODO: Test -Os, -Oz.
+		if ! is-flagq '-O@(2|3)' ; then
+			# Lock glibc at -O2. We want to be conservative here.
+			filter-flags '-O?'
+			append-flags -O2
+		fi
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if ! use cet; then
+		if use amd64 || use x86; then
+			append-flags '-fcf-protection=none'
+		elif use arm64; then
+			append-flags '-mbranch-protection=none'
+		fi
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP=${CPP}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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})"
+		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	case ${ABI}-${CTARGET} in
+		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
+			"${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
+			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-05-30 12:00 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-05-30 12:00 UTC (permalink / raw
  To: gentoo-commits

commit:     6141a9c24b043190b727955702f2fbe1927aa378
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu May 30 12:00:36 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu May 30 12:00:48 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6141a9c2

sys-libs/glibc: keyword 2.39-r7

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r7.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r7.ebuild b/sys-libs/glibc/glibc-2.39-r7.ebuild
index 400ff741123b..ceafcc6e5084 100644
--- a/sys-libs/glibc/glibc-2.39-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r7.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-06-11 20:16 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-06-11 20:16 UTC (permalink / raw
  To: gentoo-commits

commit:     7df301dc89c4fb028895dfe837e3e3f2d21e2994
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 11 20:14:05 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jun 11 20:16:09 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7df301dc

sys-libs/glibc: add 2.39 patchlevel 8

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.39-r8.ebuild | 1741 +++++++++++++++++++++++++++++++++++
 2 files changed, 1742 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index ed8f6e58de43..79282bcd4e54 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -23,6 +23,7 @@ DIST glibc-2.38-patches-13.tar.xz 92708 BLAKE2B b2f05a793c92ea0b7901d2124fcd968f
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-2.39-patches-6.tar.xz 87600 BLAKE2B 7bb24a16fb64ed07a7477dad075dfedd59ab8d0d4ab3032273684405fd690a863a84fe1f859a07faab3ccd4663ba4f896ca37303cf2a4658ab1662732c50e860 SHA512 d48de19e9e33ef334cdbd63b6ceaddff12424477193f6bb0876105e193f2aba44cb48c33aebc47546db76dc229849cc22f884a68971bbc23994769b64bcd345c
 DIST glibc-2.39-patches-7.tar.xz 104640 BLAKE2B 9dba666c20aa4f4dde29fcc7173e53f08037102d0e53634533ac900f90d99a76f0f26064f6f71c72c75fa788f501e562a9f9548ebb44ded26ec55a5344e99d1e SHA512 214bf3256177141e059531775ed74d813a01a1e4f15892c40f7e70d8b26ce79216501d1cee5e6e980fbb5c2966ce427edf3136283486ae50acb88cb8e647ee0a
+DIST glibc-2.39-patches-8.tar.xz 110388 BLAKE2B 7c183934fa73a8a1dae738357ade0b858d2cc7b28f586f832500b794c2bc97c7219e6ff83d000a50378d8448a92347e066540115a46f7016bb21546e8b1a4ea8 SHA512 5d7ef1def3f95f82dd7d29781259e14b61f4b16534d2694bced7b0493e431f84fa238422592f5fb8d61fc9f5a4261384b937ef147dd04e11adcbc6dca9702991
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.39-r8.ebuild b/sys-libs/glibc/glibc-2.39-r8.ebuild
new file mode 100644
index 000000000000..7dabb7152648
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.39-r8.ebuild
@@ -0,0 +1,1741 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=8
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+# Minimum systemd version needed (which contains any new syscall changes for
+# its seccomp filter!). Please double check this!
+MIN_SYSTEMD_VER="254.9-r1"
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 )"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+
+	# Fails regularly, unreliable
+	tst-valgrind-smoke
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
+		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
+		STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' \
+					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
+					| grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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.
+				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
+				CC_mangled=${CC}
+				CC=${glibc__GLIBC_CC}
+				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
+				CC=${CC_mangled}
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+
+		# Allow -O2 and -O3, but nothing else for now.
+		# TODO: Test -Os, -Oz.
+		if ! is-flagq '-O@(2|3)' ; then
+			# Lock glibc at -O2. We want to be conservative here.
+			filter-flags '-O?'
+			append-flags -O2
+		fi
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if ! use cet; then
+		if use amd64 || use x86; then
+			append-flags '-fcf-protection=none'
+		elif use arm64; then
+			append-flags '-mbranch-protection=none'
+		fi
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP=${CPP}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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})"
+		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	case ${ABI}-${CTARGET} in
+		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
+			"${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
+			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-06-12 23:16 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-06-12 23:16 UTC (permalink / raw
  To: gentoo-commits

commit:     172d2d0406fc7241aef756bf2aee1c978b699533
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 12 23:15:37 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jun 12 23:16:27 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=172d2d04

sys-libs/glibc: drop broken 2.39-r8, add fixed patchset 9 in 2.39-r9

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest                                       | 2 +-
 sys-libs/glibc/{glibc-2.39-r8.ebuild => glibc-2.39-r9.ebuild} | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 79282bcd4e54..0b28c8c37ff3 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -23,7 +23,7 @@ DIST glibc-2.38-patches-13.tar.xz 92708 BLAKE2B b2f05a793c92ea0b7901d2124fcd968f
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-2.39-patches-6.tar.xz 87600 BLAKE2B 7bb24a16fb64ed07a7477dad075dfedd59ab8d0d4ab3032273684405fd690a863a84fe1f859a07faab3ccd4663ba4f896ca37303cf2a4658ab1662732c50e860 SHA512 d48de19e9e33ef334cdbd63b6ceaddff12424477193f6bb0876105e193f2aba44cb48c33aebc47546db76dc229849cc22f884a68971bbc23994769b64bcd345c
 DIST glibc-2.39-patches-7.tar.xz 104640 BLAKE2B 9dba666c20aa4f4dde29fcc7173e53f08037102d0e53634533ac900f90d99a76f0f26064f6f71c72c75fa788f501e562a9f9548ebb44ded26ec55a5344e99d1e SHA512 214bf3256177141e059531775ed74d813a01a1e4f15892c40f7e70d8b26ce79216501d1cee5e6e980fbb5c2966ce427edf3136283486ae50acb88cb8e647ee0a
-DIST glibc-2.39-patches-8.tar.xz 110388 BLAKE2B 7c183934fa73a8a1dae738357ade0b858d2cc7b28f586f832500b794c2bc97c7219e6ff83d000a50378d8448a92347e066540115a46f7016bb21546e8b1a4ea8 SHA512 5d7ef1def3f95f82dd7d29781259e14b61f4b16534d2694bced7b0493e431f84fa238422592f5fb8d61fc9f5a4261384b937ef147dd04e11adcbc6dca9702991
+DIST glibc-2.39-patches-9.tar.xz 110948 BLAKE2B b958561bbc0fefa5982f0aa16dd02cc9cbd015d30d203c02d9ee72605aa51c3e25fac39759487c0deb382a793e3e0274e5585c5a4bd0036bcfaa30fc7dad9021 SHA512 d954a846c4308d4e16d3e878f1ed9ec62f3d78328043289a38cb15148ccf6b431e4a0f185e138300c141ba7e63247922f916ecbab2c8eeaa99d31c54b1ebd0fb
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.39-r8.ebuild b/sys-libs/glibc/glibc-2.39-r9.ebuild
similarity index 99%
rename from sys-libs/glibc/glibc-2.39-r8.ebuild
rename to sys-libs/glibc/glibc-2.39-r9.ebuild
index 7dabb7152648..8430074007f7 100644
--- a/sys-libs/glibc/glibc-2.39-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r9.ebuild
@@ -12,7 +12,7 @@ TMPFILES_OPTIONAL=1
 EMULTILIB_PKG="true"
 
 # Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=8
+PATCH_VER=9
 PATCH_DEV=dilfridge
 
 # gcc mulitilib bootstrap files version


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-06-12 23:29 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-06-12 23:29 UTC (permalink / raw
  To: gentoo-commits

commit:     c9c5100bdbf0ad570dd67ba4a20152579aa6cc3d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 12 23:28:58 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 12 23:28:58 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c9c5100b

sys-libs/glibc: XFAIL tst-shstk-legacy-1g test

Pending investigation.

Bug: https://bugs.gentoo.org/927973
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r9.ebuild | 3 +++
 sys-libs/glibc/glibc-9999.ebuild    | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.39-r9.ebuild b/sys-libs/glibc/glibc-2.39-r9.ebuild
index de63f7d4c8f8..f13a557d9c05 100644
--- a/sys-libs/glibc/glibc-2.39-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r9.ebuild
@@ -181,6 +181,9 @@ XFAIL_TEST_LIST=(
 
 	# Fails regularly, unreliable
 	tst-valgrind-smoke
+
+	# https://sourceware.org/bugzilla/show_bug.cgi?id=31877 (bug #927973)
+	tst-shstk-legacy-1g
 )
 
 XFAIL_NSPAWN_TEST_LIST=(

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index c7e9b1d0e94a..9c4e809026bb 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -181,6 +181,9 @@ XFAIL_TEST_LIST=(
 
 	# Fails regularly, unreliable
 	tst-valgrind-smoke
+
+	# https://sourceware.org/bugzilla/show_bug.cgi?id=31877 (bug #927973)
+	tst-shstk-legacy-1g
 )
 
 XFAIL_NSPAWN_TEST_LIST=(


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-06-12 23:29 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-06-12 23:29 UTC (permalink / raw
  To: gentoo-commits

commit:     1503e65c800f54cadb6c2503ce839d1dbcf3ceef
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 12 23:27:13 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 12 23:27:30 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1503e65c

sys-libs/glibc: drop old AVX512 workaround

Bug: https://bugs.gentoo.org/823780
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r9.ebuild | 10 ----------
 sys-libs/glibc/glibc-9999.ebuild    | 10 ----------
 2 files changed, 20 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.39-r9.ebuild b/sys-libs/glibc/glibc-2.39-r9.ebuild
index 8430074007f7..de63f7d4c8f8 100644
--- a/sys-libs/glibc/glibc-2.39-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r9.ebuild
@@ -366,16 +366,6 @@ setup_target_flags() {
 				fi
 				# For compatibility with older binaries at slight performance cost.
 				use stack-realign && export CFLAGS_x86+=" -mstackrealign"
-
-				# Workaround for bug #823780.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
 			fi
 		;;
 		mips)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 0cbc0a06f45e..c7e9b1d0e94a 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -366,16 +366,6 @@ setup_target_flags() {
 				fi
 				# For compatibility with older binaries at slight performance cost.
 				use stack-realign && export CFLAGS_x86+=" -mstackrealign"
-
-				# Workaround for bug #823780.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
 			fi
 		;;
 		mips)


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-06-13 13:56 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-06-13 13:56 UTC (permalink / raw
  To: gentoo-commits

commit:     b1377ca21ebf6775928e9491260548401a26459e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 13 13:55:55 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Jun 13 13:55:55 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b1377ca2

sys-libs/glibc: keyword 2.39-r9

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r9.ebuild b/sys-libs/glibc/glibc-2.39-r9.ebuild
index f13a557d9c05..201210eb7976 100644
--- a/sys-libs/glibc/glibc-2.39-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r9.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-06-14 12:46 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-06-14 12:46 UTC (permalink / raw
  To: gentoo-commits

commit:     4dea6def615f8c1d66ce6284e172eea097e66b2d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 14 12:44:19 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Jun 14 12:45:58 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4dea6def

sys-libs/glibc: stabilize 2.39-r9 for x86

Bug: https://bugs.gentoo.org/933764
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r9.ebuild b/sys-libs/glibc/glibc-2.39-r9.ebuild
index 201210eb7976..e6650fa8057d 100644
--- a/sys-libs/glibc/glibc-2.39-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r9.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-06-24  1:28 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-06-24  1:28 UTC (permalink / raw
  To: gentoo-commits

commit:     8a2668b938264825869a7a0c6c7ac0799156cf96
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 24 01:26:18 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 24 01:26:18 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8a2668b9

sys-libs/glibc: pass -fcf-protection=none based on CTARGET

Closes: https://bugs.gentoo.org/932250
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r6.ebuild | 13 ++++++++-----
 sys-libs/glibc/glibc-2.39-r7.ebuild | 13 ++++++++-----
 sys-libs/glibc/glibc-2.39-r9.ebuild | 13 ++++++++-----
 sys-libs/glibc/glibc-9999.ebuild    | 13 ++++++++-----
 4 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.39-r6.ebuild b/sys-libs/glibc/glibc-2.39-r6.ebuild
index 6772a8cdcc8b..d4820cc75723 100644
--- a/sys-libs/glibc/glibc-2.39-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r6.ebuild
@@ -522,11 +522,14 @@ setup_flags() {
 	# dealing with CET in ld.so. So if CET is supposed to be
 	# disabled for glibc, be explicit about it.
 	if ! use cet; then
-		if use amd64 || use x86; then
-			append-flags '-fcf-protection=none'
-		elif use arm64; then
-			append-flags '-mbranch-protection=none'
-		fi
+		case ${ABI}-${CTARGET} in
+			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
+				append-flags '-fcf-protection=none'
+				;;
+			arm64-aarch64*)
+				append-flags '-mbranch-protection=none'
+				;;
+		esac
 	fi
 }
 

diff --git a/sys-libs/glibc/glibc-2.39-r7.ebuild b/sys-libs/glibc/glibc-2.39-r7.ebuild
index ceafcc6e5084..90f211bebf68 100644
--- a/sys-libs/glibc/glibc-2.39-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r7.ebuild
@@ -522,11 +522,14 @@ setup_flags() {
 	# dealing with CET in ld.so. So if CET is supposed to be
 	# disabled for glibc, be explicit about it.
 	if ! use cet; then
-		if use amd64 || use x86; then
-			append-flags '-fcf-protection=none'
-		elif use arm64; then
-			append-flags '-mbranch-protection=none'
-		fi
+		case ${ABI}-${CTARGET} in
+			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
+				append-flags '-fcf-protection=none'
+				;;
+			arm64-aarch64*)
+				append-flags '-mbranch-protection=none'
+				;;
+		esac
 	fi
 }
 

diff --git a/sys-libs/glibc/glibc-2.39-r9.ebuild b/sys-libs/glibc/glibc-2.39-r9.ebuild
index e6650fa8057d..da579ed2837b 100644
--- a/sys-libs/glibc/glibc-2.39-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r9.ebuild
@@ -515,11 +515,14 @@ setup_flags() {
 	# dealing with CET in ld.so. So if CET is supposed to be
 	# disabled for glibc, be explicit about it.
 	if ! use cet; then
-		if use amd64 || use x86; then
-			append-flags '-fcf-protection=none'
-		elif use arm64; then
-			append-flags '-mbranch-protection=none'
-		fi
+		case ${ABI}-${CTARGET} in
+			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
+				append-flags '-fcf-protection=none'
+				;;
+			arm64-aarch64*)
+				append-flags '-mbranch-protection=none'
+				;;
+		esac
 	fi
 }
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 270b0a868557..a1512de95b17 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -515,11 +515,14 @@ setup_flags() {
 	# dealing with CET in ld.so. So if CET is supposed to be
 	# disabled for glibc, be explicit about it.
 	if ! use cet; then
-		if use amd64 || use x86; then
-			append-flags '-fcf-protection=none'
-		elif use arm64; then
-			append-flags '-mbranch-protection=none'
-		fi
+		case ${ABI}-${CTARGET} in
+			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
+				append-flags '-fcf-protection=none'
+				;;
+			arm64-aarch64*)
+				append-flags '-mbranch-protection=none'
+				;;
+		esac
 	fi
 }
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-06-26 14:59 Mike Gilbert
  0 siblings, 0 replies; 1076+ messages in thread
From: Mike Gilbert @ 2024-06-26 14:59 UTC (permalink / raw
  To: gentoo-commits

commit:     051caa38b6eeb4e05e8a7dc4ba9e3b3d41ae3ba3
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 25 15:01:39 2024 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Wed Jun 26 14:56:20 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=051caa38

sys-libs/glibc: improve amd64 multilib message

Closes: https://bugs.gentoo.org/934391
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r3.ebuild  | 8 ++++++--
 sys-libs/glibc/glibc-2.31-r7.ebuild  | 8 ++++++--
 sys-libs/glibc/glibc-2.32-r8.ebuild  | 8 ++++++--
 sys-libs/glibc/glibc-2.33-r14.ebuild | 8 ++++++--
 sys-libs/glibc/glibc-2.34-r14.ebuild | 8 ++++++--
 sys-libs/glibc/glibc-2.35-r11.ebuild | 8 ++++++--
 sys-libs/glibc/glibc-2.36-r8.ebuild  | 8 ++++++--
 sys-libs/glibc/glibc-2.37-r10.ebuild | 8 ++++++--
 sys-libs/glibc/glibc-2.38-r13.ebuild | 8 ++++++--
 sys-libs/glibc/glibc-2.39-r6.ebuild  | 8 ++++++--
 sys-libs/glibc/glibc-2.39-r7.ebuild  | 8 ++++++--
 sys-libs/glibc/glibc-2.39-r9.ebuild  | 8 ++++++--
 sys-libs/glibc/glibc-9999.ebuild     | 8 ++++++--
 13 files changed, 78 insertions(+), 26 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r3.ebuild b/sys-libs/glibc/glibc-2.19-r3.ebuild
index 4098211ce0aa..06c7071e8efb 100644
--- a/sys-libs/glibc/glibc-2.19-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r3.ebuild
@@ -612,7 +612,7 @@ sanity_prechecks() {
 	# we test for...
 	if ! is_crosscompile ; then
 		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking that IA32 emulation is enabled in the running kernel"
+			ebegin "Checking if the system can execute 32-bit binaries"
 			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
@@ -626,7 +626,11 @@ sanity_prechecks() {
 			fi
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
 		fi
 
 	fi

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index 2625a376cfa0..e531ada0b011 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -649,7 +649,7 @@ sanity_prechecks() {
 	# we test for...
 	if ! is_crosscompile ; then
 		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking that IA32 emulation is enabled in the running kernel"
+			ebegin "Checking if the system can execute 32-bit binaries"
 			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
@@ -663,7 +663,11 @@ sanity_prechecks() {
 			fi
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
 		fi
 
 	fi

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index 977997ef0840..65aa84f364aa 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -666,7 +666,7 @@ sanity_prechecks() {
 	# we test for...
 	if ! is_crosscompile ; then
 		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking that IA32 emulation is enabled in the running kernel"
+			ebegin "Checking if the system can execute 32-bit binaries"
 			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
@@ -680,7 +680,11 @@ sanity_prechecks() {
 			fi
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
 		fi
 
 	fi

diff --git a/sys-libs/glibc/glibc-2.33-r14.ebuild b/sys-libs/glibc/glibc-2.33-r14.ebuild
index a9012e350120..9119534902f5 100644
--- a/sys-libs/glibc/glibc-2.33-r14.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r14.ebuild
@@ -733,7 +733,7 @@ sanity_prechecks() {
 	# we test for...
 	if ! is_crosscompile ; then
 		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking that IA32 emulation is enabled in the running kernel"
+			ebegin "Checking if the system can execute 32-bit binaries"
 			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
@@ -747,7 +747,11 @@ sanity_prechecks() {
 			fi
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
 		fi
 
 	fi

diff --git a/sys-libs/glibc/glibc-2.34-r14.ebuild b/sys-libs/glibc/glibc-2.34-r14.ebuild
index 9d92b5e3783f..1affa01b9a4d 100644
--- a/sys-libs/glibc/glibc-2.34-r14.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r14.ebuild
@@ -742,7 +742,7 @@ sanity_prechecks() {
 	# we test for...
 	if ! is_crosscompile ; then
 		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking that IA32 emulation is enabled in the running kernel"
+			ebegin "Checking if the system can execute 32-bit binaries"
 			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
@@ -756,7 +756,11 @@ sanity_prechecks() {
 			fi
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
 		fi
 
 	fi

diff --git a/sys-libs/glibc/glibc-2.35-r11.ebuild b/sys-libs/glibc/glibc-2.35-r11.ebuild
index 86a7d2673b22..0c63dac54d10 100644
--- a/sys-libs/glibc/glibc-2.35-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r11.ebuild
@@ -761,7 +761,7 @@ sanity_prechecks() {
 	# we test for...
 	if ! is_crosscompile ; then
 		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking that IA32 emulation is enabled in the running kernel"
+			ebegin "Checking if the system can execute 32-bit binaries"
 			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
@@ -775,7 +775,11 @@ sanity_prechecks() {
 			fi
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
 		fi
 
 	fi

diff --git a/sys-libs/glibc/glibc-2.36-r8.ebuild b/sys-libs/glibc/glibc-2.36-r8.ebuild
index caac3e58f9b6..b8bf8d174f36 100644
--- a/sys-libs/glibc/glibc-2.36-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r8.ebuild
@@ -792,7 +792,7 @@ sanity_prechecks() {
 	# we test for...
 	if ! is_crosscompile ; then
 		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking that IA32 emulation is enabled in the running kernel"
+			ebegin "Checking if the system can execute 32-bit binaries"
 			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
@@ -806,7 +806,11 @@ sanity_prechecks() {
 			fi
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
 		fi
 
 	fi

diff --git a/sys-libs/glibc/glibc-2.37-r10.ebuild b/sys-libs/glibc/glibc-2.37-r10.ebuild
index 53335dbbd2f7..84368cf8f50f 100644
--- a/sys-libs/glibc/glibc-2.37-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r10.ebuild
@@ -801,7 +801,7 @@ sanity_prechecks() {
 	# we test for...
 	if ! is_crosscompile ; then
 		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking that IA32 emulation is enabled in the running kernel"
+			ebegin "Checking if the system can execute 32-bit binaries"
 			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
@@ -815,7 +815,11 @@ sanity_prechecks() {
 			fi
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
 		fi
 
 	fi

diff --git a/sys-libs/glibc/glibc-2.38-r13.ebuild b/sys-libs/glibc/glibc-2.38-r13.ebuild
index 1de5a90ac29b..3ff40e502358 100644
--- a/sys-libs/glibc/glibc-2.38-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r13.ebuild
@@ -812,7 +812,7 @@ sanity_prechecks() {
 	# we test for...
 	if ! is_crosscompile ; then
 		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking that IA32 emulation is enabled in the running kernel"
+			ebegin "Checking if the system can execute 32-bit binaries"
 			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
@@ -826,7 +826,11 @@ sanity_prechecks() {
 			fi
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
 		fi
 
 	fi

diff --git a/sys-libs/glibc/glibc-2.39-r6.ebuild b/sys-libs/glibc/glibc-2.39-r6.ebuild
index d4820cc75723..25ea3a7768f3 100644
--- a/sys-libs/glibc/glibc-2.39-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r6.ebuild
@@ -837,7 +837,7 @@ sanity_prechecks() {
 	# we test for...
 	if ! is_crosscompile ; then
 		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking that IA32 emulation is enabled in the running kernel"
+			ebegin "Checking if the system can execute 32-bit binaries"
 			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
@@ -851,7 +851,11 @@ sanity_prechecks() {
 			fi
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
 		fi
 
 	fi

diff --git a/sys-libs/glibc/glibc-2.39-r7.ebuild b/sys-libs/glibc/glibc-2.39-r7.ebuild
index 90f211bebf68..3e175b82b580 100644
--- a/sys-libs/glibc/glibc-2.39-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r7.ebuild
@@ -837,7 +837,7 @@ sanity_prechecks() {
 	# we test for...
 	if ! is_crosscompile ; then
 		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking that IA32 emulation is enabled in the running kernel"
+			ebegin "Checking if the system can execute 32-bit binaries"
 			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
@@ -851,7 +851,11 @@ sanity_prechecks() {
 			fi
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
 		fi
 
 	fi

diff --git a/sys-libs/glibc/glibc-2.39-r9.ebuild b/sys-libs/glibc/glibc-2.39-r9.ebuild
index da579ed2837b..d15adef9b01f 100644
--- a/sys-libs/glibc/glibc-2.39-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r9.ebuild
@@ -830,7 +830,7 @@ sanity_prechecks() {
 	# we test for...
 	if ! is_crosscompile ; then
 		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking that IA32 emulation is enabled in the running kernel"
+			ebegin "Checking if the system can execute 32-bit binaries"
 			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
@@ -844,7 +844,11 @@ sanity_prechecks() {
 			fi
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
 		fi
 
 	fi

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a1512de95b17..f6b2e565a6a6 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -830,7 +830,7 @@ sanity_prechecks() {
 	# we test for...
 	if ! is_crosscompile ; then
 		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking that IA32 emulation is enabled in the running kernel"
+			ebegin "Checking if the system can execute 32-bit binaries"
 			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
@@ -844,7 +844,11 @@ sanity_prechecks() {
 			fi
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
 		fi
 
 	fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-06-28 18:05 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-06-28 18:05 UTC (permalink / raw
  To: gentoo-commits

commit:     25eeafb6c4ba6becb64faad5b7b40c5ff4f94868
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 28 18:05:01 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jun 28 18:05:01 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=25eeafb6

sys-libs/glibc: Stabilize 2.39-r6 hppa, #932094

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r6.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r6.ebuild b/sys-libs/glibc/glibc-2.39-r6.ebuild
index 25ea3a7768f3..e7ae15692d7a 100644
--- a/sys-libs/glibc/glibc-2.39-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r6.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa -ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa -ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-07-22 15:37 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-07-22 15:37 UTC (permalink / raw
  To: gentoo-commits

commit:     a10aaa15d9ac5929a4c9bb3441c2500a254de4a7
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 22 15:36:27 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jul 22 15:37:39 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a10aaa15

sys-libs/glibc: add 2.40

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest          |    2 +
 sys-libs/glibc/glibc-2.40.ebuild | 1734 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 1736 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 0b28c8c37ff3..56575cf02b5e 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -25,6 +25,8 @@ DIST glibc-2.39-patches-6.tar.xz 87600 BLAKE2B 7bb24a16fb64ed07a7477dad075dfedd5
 DIST glibc-2.39-patches-7.tar.xz 104640 BLAKE2B 9dba666c20aa4f4dde29fcc7173e53f08037102d0e53634533ac900f90d99a76f0f26064f6f71c72c75fa788f501e562a9f9548ebb44ded26ec55a5344e99d1e SHA512 214bf3256177141e059531775ed74d813a01a1e4f15892c40f7e70d8b26ce79216501d1cee5e6e980fbb5c2966ce427edf3136283486ae50acb88cb8e647ee0a
 DIST glibc-2.39-patches-9.tar.xz 110948 BLAKE2B b958561bbc0fefa5982f0aa16dd02cc9cbd015d30d203c02d9ee72605aa51c3e25fac39759487c0deb382a793e3e0274e5585c5a4bd0036bcfaa30fc7dad9021 SHA512 d954a846c4308d4e16d3e878f1ed9ec62f3d78328043289a38cb15148ccf6b431e4a0f185e138300c141ba7e63247922f916ecbab2c8eeaa99d31c54b1ebd0fb
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
+DIST glibc-2.40-patches-1.tar.xz 17316 BLAKE2B 7c44b9a6f1b34aa5240a1d68721acf399e488c2e9f6e838d16344f4e87737e516c975547fa23baba386263ccfdd26832df2e78040c95d0faa53b32e2343c9831 SHA512 5b922cb4a9150fc2380be834e2c6cf62340c23476e9e1ec6a7954e1f01686e8b6d65108a9a07a96d580b863376e0dfc829b6b4d3ac2a6f99de2fb87a51125d78
+DIST glibc-2.40.tar.xz 18752204 BLAKE2B 8593cab5b2549b77159b6866fbb40b917e491fd5bc0814f7f85b6529166d78d4583436450c479b86cdfe468304fc4d2a9ba8294230a55dbc4c15e89c3ab6c000 SHA512 33caf91dbfddde6480b7cdf7a68b36aff8c522bfee56160af26af297f1b768668edb08bc4e1a7ff61c64721e3c1d49c347a5dd01c5edd3b914ee6479c8b27885
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc
 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff

diff --git a/sys-libs/glibc/glibc-2.40.ebuild b/sys-libs/glibc/glibc-2.40.ebuild
new file mode 100644
index 000000000000..9c4e809026bb
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.40.ebuild
@@ -0,0 +1,1734 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=1
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+# Minimum systemd version needed (which contains any new syscall changes for
+# its seccomp filter!). Please double check this!
+MIN_SYSTEMD_VER="254.9-r1"
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 )"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+
+	# Fails regularly, unreliable
+	tst-valgrind-smoke
+
+	# https://sourceware.org/bugzilla/show_bug.cgi?id=31877 (bug #927973)
+	tst-shstk-legacy-1g
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
+		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
+		STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' \
+					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
+					| grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+
+		# Allow -O2 and -O3, but nothing else for now.
+		# TODO: Test -Os, -Oz.
+		if ! is-flagq '-O@(2|3)' ; then
+			# Lock glibc at -O2. We want to be conservative here.
+			filter-flags '-O?'
+			append-flags -O2
+		fi
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if ! use cet; then
+		if use amd64 || use x86; then
+			append-flags '-fcf-protection=none'
+		elif use arm64; then
+			append-flags '-mbranch-protection=none'
+		fi
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# 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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP=${CPP}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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})"
+		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	case ${ABI}-${CTARGET} in
+		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
+			"${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
+			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-07-22 20:46 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-07-22 20:46 UTC (permalink / raw
  To: gentoo-commits

commit:     99f524787229e6bb5c8267cb884fb474ef01a86c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 22 20:45:45 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jul 22 20:45:57 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=99f52478

sys-libs/glibc: keyword 2.40 (still pmasked)

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.40.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.40.ebuild b/sys-libs/glibc/glibc-2.40.ebuild
index 9c4e809026bb..5f4b0a49f4b4 100644
--- a/sys-libs/glibc/glibc-2.40.ebuild
+++ b/sys-libs/glibc/glibc-2.40.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-07-27 15:42 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-07-27 15:42 UTC (permalink / raw
  To: gentoo-commits

commit:     b955cbfac02d53fe44382842b7f3feb4df559fc3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 27 15:41:20 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jul 27 15:42:16 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b955cbfa

sys-libs/glibc: backport fixes from 9999 to 2.39-r9 and 2.40

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r9.ebuild |  2 +-
 sys-libs/glibc/glibc-2.40.ebuild    | 23 +++++++++++++++--------
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.39-r9.ebuild b/sys-libs/glibc/glibc-2.39-r9.ebuild
index d15adef9b01f..2212b1fce664 100644
--- a/sys-libs/glibc/glibc-2.39-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r9.ebuild
@@ -1001,7 +1001,7 @@ glibc_do_configure() {
 	# worth protecting from stack smashes.
 	myconf+=( --enable-stack-protector=$(usex ssp strong no) )
 
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# Keep a whitelist of targets supporting IFUNC. glibc's ./configure
 	# is not robust enough to detect proper support:
 	#    https://bugs.gentoo.org/641216
 	#    https://sourceware.org/PR22634#c0

diff --git a/sys-libs/glibc/glibc-2.40.ebuild b/sys-libs/glibc/glibc-2.40.ebuild
index 5f4b0a49f4b4..9210c1e498ff 100644
--- a/sys-libs/glibc/glibc-2.40.ebuild
+++ b/sys-libs/glibc/glibc-2.40.ebuild
@@ -515,11 +515,14 @@ setup_flags() {
 	# dealing with CET in ld.so. So if CET is supposed to be
 	# disabled for glibc, be explicit about it.
 	if ! use cet; then
-		if use amd64 || use x86; then
-			append-flags '-fcf-protection=none'
-		elif use arm64; then
-			append-flags '-mbranch-protection=none'
-		fi
+		case ${ABI}-${CTARGET} in
+			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
+				append-flags '-fcf-protection=none'
+				;;
+			arm64-aarch64*)
+				append-flags '-mbranch-protection=none'
+				;;
+		esac
 	fi
 }
 
@@ -827,7 +830,7 @@ sanity_prechecks() {
 	# we test for...
 	if ! is_crosscompile ; then
 		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking that IA32 emulation is enabled in the running kernel"
+			ebegin "Checking if the system can execute 32-bit binaries"
 			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
@@ -841,7 +844,11 @@ sanity_prechecks() {
 			fi
 			rm -f "${T}/check-ia32-emulation.elf32"
 			eend $STAT
-			[[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
 		fi
 
 	fi
@@ -994,7 +1001,7 @@ glibc_do_configure() {
 	# worth protecting from stack smashes.
 	myconf+=( --enable-stack-protector=$(usex ssp strong no) )
 
-	# Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+	# Keep a whitelist of targets supporting IFUNC. glibc's ./configure
 	# is not robust enough to detect proper support:
 	#    https://bugs.gentoo.org/641216
 	#    https://sourceware.org/PR22634#c0


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-07-28  3:35 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-07-28  3:35 UTC (permalink / raw
  To: gentoo-commits

commit:     527762d587507d168575f7d32440dbfade4134ad
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 28 03:34:08 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jul 28 03:34:08 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=527762d5

sys-libs/glibc: filter -fno-semantic-interposition

It makes no sense for glibc itself and will break e.g. NSS.

Bug: https://bugs.gentoo.org/798774
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r9.ebuild | 3 +++
 sys-libs/glibc/glibc-2.40.ebuild    | 3 +++
 sys-libs/glibc/glibc-9999.ebuild    | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.39-r9.ebuild b/sys-libs/glibc/glibc-2.39-r9.ebuild
index 2212b1fce664..b73cd8b325eb 100644
--- a/sys-libs/glibc/glibc-2.39-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r9.ebuild
@@ -477,6 +477,9 @@ setup_flags() {
 	# #898098
 	filter-flags -fno-builtin
 
+	# #798774
+	filter-flags -fno-semantic-interposition
+
 	# #829583
 	filter-lfs-flags
 

diff --git a/sys-libs/glibc/glibc-2.40.ebuild b/sys-libs/glibc/glibc-2.40.ebuild
index 9210c1e498ff..1e2debc4ab65 100644
--- a/sys-libs/glibc/glibc-2.40.ebuild
+++ b/sys-libs/glibc/glibc-2.40.ebuild
@@ -477,6 +477,9 @@ setup_flags() {
 	# #898098
 	filter-flags -fno-builtin
 
+	# #798774
+	filter-flags -fno-semantic-interposition
+
 	# #829583
 	filter-lfs-flags
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f6b2e565a6a6..a509c476c930 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -477,6 +477,9 @@ setup_flags() {
 	# #898098
 	filter-flags -fno-builtin
 
+	# #798774
+	filter-flags -fno-semantic-interposition
+
 	# #829583
 	filter-lfs-flags
 


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-08-26 16:33 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-08-26 16:33 UTC (permalink / raw
  To: gentoo-commits

commit:     412625e21fccfd502eef2998157003df59179f32
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 26 16:32:39 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 26 16:33:20 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=412625e2

sys-libs/glibc: update EAPI 6 -> 8 for 2.19-r3

Done somewhat blindly but I ran up to compile phase (couldn't get further
because of a linker issue) and also compared slowly with newer glibc
ebuilds.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r3.ebuild | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r3.ebuild b/sys-libs/glibc/glibc-2.19-r3.ebuild
index 06c7071e8efb..1ebbe700f363 100644
--- a/sys-libs/glibc/glibc-2.19-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r3.ebuild
@@ -1,7 +1,7 @@
 # Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI=8
 
 TMPFILES_OPTIONAL=1
 
@@ -10,6 +10,7 @@ inherit prefix toolchain-funcs flag-o-matic gnuconfig \
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/"
+
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
 SLOT="2.2"
 
@@ -464,7 +465,7 @@ check_devpts() {
 	[[ ${MERGE_TYPE} == "buildonly" ]] && return
 
 	# Only sanity check when installing the native glibc.
-	[[ ${ROOT} != "/" ]] && return
+	[[ -n ${ROOT} ]] && return
 
 	# If they're opting in to the old suid code, then no need to check.
 	use suid && return
@@ -552,7 +553,7 @@ sanity_prechecks() {
 
 	# Prevent native builds from downgrading
 	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ ${ROOT} == "/" ]] && \
+	   [[ -z ${ROOT} ]] && \
 	   [[ ${CBUILD} == ${CHOST} ]] && \
 	   [[ ${CHOST} == ${CTARGET} ]] ; then
 
@@ -625,8 +626,8 @@ sanity_prechecks() {
 				STAT=0
 			fi
 			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			if [[ $STAT -ne 0 ]]; then
+			eend ${STAT}
+			if [[ ${STAT} -ne 0 ]]; then
 				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
 				eerror "Seek support otherwise."
 				die "Unable to execute 32-bit binaries"
@@ -1030,10 +1031,10 @@ src_test() {
 run_locale_gen() {
 	# if the host locales.gen contains no entries, we'll install everything
 	local root="$1"
-	local locale_list="${root}/etc/locale.gen"
+	local locale_list="${root%/}/etc/locale.gen"
 	if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
 		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
 
 	locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
@@ -1044,7 +1045,7 @@ glibc_do_src_install() {
 	local builddir=$(builddir nptl)
 	cd "${builddir}"
 
-	emake install_root="${D}$(alt_prefix)" install
+	emake install_root="${D}/$(alt_prefix)" install
 
 	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
 	# which come without headers etc. Only needed for binary packages since the
@@ -1061,9 +1062,9 @@ glibc_do_src_install() {
 		# Move versioned .a file out of libdir to evade portage QA checks
 		# instead of using gen_usr_ldscript(). We fix ldscript as:
 		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
 		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
 	fi
 
 	# We'll take care of the cache ourselves
@@ -1218,7 +1219,7 @@ glibc_do_src_install() {
 glibc_headers_install() {
 	local builddir=$(builddir "headers")
 	cd "${builddir}"
-	emake install_root="${D}$(alt_prefix)" install-headers
+	emake install_root="${D}/$(alt_prefix)" install-headers
 
 	insinto $(alt_headers)/gnu
 	doins "${S}"/include/gnu/stubs.h
@@ -1289,7 +1290,7 @@ pkg_preinst() {
 		einfo "Defaulting /etc/host.conf:multi to on"
 	fi
 
-	[[ ${ROOT} != "/" ]] && return 0
+	[[ -n ${ROOT} ]] && return 0
 	[[ -d ${ED}/$(get_libdir) ]] || return 0
 	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
 }
@@ -1300,11 +1301,11 @@ pkg_postinst() {
 
 	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
 		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
 	fi
 
-	if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
-		use compile-locales || run_locale_gen "${EROOT}"
+	if ! is_crosscompile && [[ -n ${ROOT} ]] ; then
+		use compile-locales || run_locale_gen "${EROOT}/"
 	fi
 
 	# Check for sanity of /etc/nsswitch.conf, take 2


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-08-31  0:33 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-08-31  0:33 UTC (permalink / raw
  To: gentoo-commits

commit:     55d371a690e2b3d27dc237ebdab51d74c11388cd
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 31 00:31:36 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Aug 31 00:32:32 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=55d371a6

sys-libs/glibc: fix disabling alternative linkers

This works now that tc-ld-force-bfd got fixed recently.

Closes: https://bugs.gentoo.org/860900
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r3.ebuild  | 6 ++++--
 sys-libs/glibc/glibc-2.31-r7.ebuild  | 6 ++++--
 sys-libs/glibc/glibc-2.32-r8.ebuild  | 6 ++++--
 sys-libs/glibc/glibc-2.33-r14.ebuild | 6 ++++--
 sys-libs/glibc/glibc-2.34-r14.ebuild | 6 ++++--
 sys-libs/glibc/glibc-2.35-r11.ebuild | 6 ++++--
 sys-libs/glibc/glibc-2.36-r8.ebuild  | 6 ++++--
 sys-libs/glibc/glibc-2.37-r10.ebuild | 6 ++++--
 sys-libs/glibc/glibc-2.38-r13.ebuild | 6 ++++--
 sys-libs/glibc/glibc-2.39-r6.ebuild  | 6 ++++--
 sys-libs/glibc/glibc-2.39-r7.ebuild  | 6 ++++--
 sys-libs/glibc/glibc-2.39-r9.ebuild  | 6 ++++--
 sys-libs/glibc/glibc-2.40.ebuild     | 6 ++++--
 sys-libs/glibc/glibc-9999.ebuild     | 6 ++++--
 14 files changed, 56 insertions(+), 28 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r3.ebuild b/sys-libs/glibc/glibc-2.19-r3.ebuild
index 1ebbe700f363..c0f528d06063 100644
--- a/sys-libs/glibc/glibc-2.19-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r3.ebuild
@@ -741,8 +741,10 @@ src_prepare() {
 }
 
 glibc_do_configure() {
-	# Glibc does not work with gold (for various reasons) #269274.
-	tc-ld-disable-gold
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
 
 	# CXX isnt handled by the multilib system, so if we dont unset here
 	# we accumulate crap across abis

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index e531ada0b011..872ca6607a3e 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -789,8 +789,10 @@ src_prepare() {
 }
 
 glibc_do_configure() {
-	# Glibc does not work with gold (for various reasons) #269274.
-	tc-ld-disable-gold
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
 
 	# CXX isnt handled by the multilib system, so if we dont unset here
 	# we accumulate crap across abis

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index 65aa84f364aa..c212d3cdad29 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -813,8 +813,10 @@ src_prepare() {
 }
 
 glibc_do_configure() {
-	# Glibc does not work with gold (for various reasons) #269274.
-	tc-ld-disable-gold
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
 
 	# CXX isnt handled by the multilib system, so if we dont unset here
 	# we accumulate crap across abis

diff --git a/sys-libs/glibc/glibc-2.33-r14.ebuild b/sys-libs/glibc/glibc-2.33-r14.ebuild
index 9119534902f5..9747f319bb27 100644
--- a/sys-libs/glibc/glibc-2.33-r14.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r14.ebuild
@@ -492,8 +492,10 @@ setup_env() {
 		return 0
 	fi
 
-	# Glibc does not work with gold (for various reasons) #269274.
-	tc-ld-disable-gold
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
 
 	if use doc ; then
 		export MAKEINFO=makeinfo

diff --git a/sys-libs/glibc/glibc-2.34-r14.ebuild b/sys-libs/glibc/glibc-2.34-r14.ebuild
index 1affa01b9a4d..08086a0295b4 100644
--- a/sys-libs/glibc/glibc-2.34-r14.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r14.ebuild
@@ -499,8 +499,10 @@ setup_env() {
 		return 0
 	fi
 
-	# Glibc does not work with gold (for various reasons) #269274.
-	tc-ld-disable-gold
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
 
 	if use doc ; then
 		export MAKEINFO=makeinfo

diff --git a/sys-libs/glibc/glibc-2.35-r11.ebuild b/sys-libs/glibc/glibc-2.35-r11.ebuild
index 0c63dac54d10..1cabb7910e7b 100644
--- a/sys-libs/glibc/glibc-2.35-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r11.ebuild
@@ -512,8 +512,10 @@ setup_env() {
 		return 0
 	fi
 
-	# Glibc does not work with gold (for various reasons) #269274.
-	tc-ld-disable-gold
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
 
 	if use doc ; then
 		export MAKEINFO=makeinfo

diff --git a/sys-libs/glibc/glibc-2.36-r8.ebuild b/sys-libs/glibc/glibc-2.36-r8.ebuild
index b8bf8d174f36..1267125bf98f 100644
--- a/sys-libs/glibc/glibc-2.36-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r8.ebuild
@@ -543,8 +543,10 @@ setup_env() {
 		return 0
 	fi
 
-	# Glibc does not work with gold (for various reasons) #269274.
-	tc-ld-disable-gold
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
 
 	if use doc ; then
 		export MAKEINFO=makeinfo

diff --git a/sys-libs/glibc/glibc-2.37-r10.ebuild b/sys-libs/glibc/glibc-2.37-r10.ebuild
index 84368cf8f50f..0cd04e2c8648 100644
--- a/sys-libs/glibc/glibc-2.37-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r10.ebuild
@@ -559,8 +559,10 @@ setup_env() {
 		return 0
 	fi
 
-	# Glibc does not work with gold (for various reasons) #269274.
-	tc-ld-disable-gold
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
 
 	if use doc ; then
 		export MAKEINFO=makeinfo

diff --git a/sys-libs/glibc/glibc-2.38-r13.ebuild b/sys-libs/glibc/glibc-2.38-r13.ebuild
index 3ff40e502358..4e9a53c699bf 100644
--- a/sys-libs/glibc/glibc-2.38-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r13.ebuild
@@ -564,8 +564,10 @@ setup_env() {
 		return 0
 	fi
 
-	# Glibc does not work with gold (for various reasons) #269274.
-	tc-ld-disable-gold
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
 
 	if use doc ; then
 		export MAKEINFO=makeinfo

diff --git a/sys-libs/glibc/glibc-2.39-r6.ebuild b/sys-libs/glibc/glibc-2.39-r6.ebuild
index e7ae15692d7a..b090b47f8075 100644
--- a/sys-libs/glibc/glibc-2.39-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r6.ebuild
@@ -589,8 +589,10 @@ setup_env() {
 		return 0
 	fi
 
-	# Glibc does not work with gold (for various reasons) #269274.
-	tc-ld-disable-gold
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
 
 	if use doc ; then
 		export MAKEINFO=makeinfo

diff --git a/sys-libs/glibc/glibc-2.39-r7.ebuild b/sys-libs/glibc/glibc-2.39-r7.ebuild
index 3e175b82b580..822a623dbddd 100644
--- a/sys-libs/glibc/glibc-2.39-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r7.ebuild
@@ -589,8 +589,10 @@ setup_env() {
 		return 0
 	fi
 
-	# Glibc does not work with gold (for various reasons) #269274.
-	tc-ld-disable-gold
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
 
 	if use doc ; then
 		export MAKEINFO=makeinfo

diff --git a/sys-libs/glibc/glibc-2.39-r9.ebuild b/sys-libs/glibc/glibc-2.39-r9.ebuild
index b73cd8b325eb..746401d90985 100644
--- a/sys-libs/glibc/glibc-2.39-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r9.ebuild
@@ -585,8 +585,10 @@ setup_env() {
 		return 0
 	fi
 
-	# Glibc does not work with gold (for various reasons) #269274.
-	tc-ld-disable-gold
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
 
 	if use doc ; then
 		export MAKEINFO=makeinfo

diff --git a/sys-libs/glibc/glibc-2.40.ebuild b/sys-libs/glibc/glibc-2.40.ebuild
index 1e2debc4ab65..102da1118a39 100644
--- a/sys-libs/glibc/glibc-2.40.ebuild
+++ b/sys-libs/glibc/glibc-2.40.ebuild
@@ -585,8 +585,10 @@ setup_env() {
 		return 0
 	fi
 
-	# Glibc does not work with gold (for various reasons) #269274.
-	tc-ld-disable-gold
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
 
 	if use doc ; then
 		export MAKEINFO=makeinfo

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index a509c476c930..26a50c00fd1e 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -585,8 +585,10 @@ setup_env() {
 		return 0
 	fi
 
-	# Glibc does not work with gold (for various reasons) #269274.
-	tc-ld-disable-gold
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
 
 	if use doc ; then
 		export MAKEINFO=makeinfo


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-09-09 10:59 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-09-09 10:59 UTC (permalink / raw
  To: gentoo-commits

commit:     edc4ba49c79dd8bb12ca156ed47cb33c9594ad50
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Sep  9 10:57:36 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Sep  9 10:58:29 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=edc4ba49

sys-libs/glibc: bump to 2.40 patchlevel 2

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.40-r1.ebuild | 1746 +++++++++++++++++++++++++++++++++++
 2 files changed, 1747 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 56575cf02b5e..ac12ffa2de99 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -26,6 +26,7 @@ DIST glibc-2.39-patches-7.tar.xz 104640 BLAKE2B 9dba666c20aa4f4dde29fcc7173e53f0
 DIST glibc-2.39-patches-9.tar.xz 110948 BLAKE2B b958561bbc0fefa5982f0aa16dd02cc9cbd015d30d203c02d9ee72605aa51c3e25fac39759487c0deb382a793e3e0274e5585c5a4bd0036bcfaa30fc7dad9021 SHA512 d954a846c4308d4e16d3e878f1ed9ec62f3d78328043289a38cb15148ccf6b431e4a0f185e138300c141ba7e63247922f916ecbab2c8eeaa99d31c54b1ebd0fb
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
 DIST glibc-2.40-patches-1.tar.xz 17316 BLAKE2B 7c44b9a6f1b34aa5240a1d68721acf399e488c2e9f6e838d16344f4e87737e516c975547fa23baba386263ccfdd26832df2e78040c95d0faa53b32e2343c9831 SHA512 5b922cb4a9150fc2380be834e2c6cf62340c23476e9e1ec6a7954e1f01686e8b6d65108a9a07a96d580b863376e0dfc829b6b4d3ac2a6f99de2fb87a51125d78
+DIST glibc-2.40-patches-2.tar.xz 48712 BLAKE2B ba98d7091e688b6469d2bbb7e1f077321b0976524b44ffaff28eb121ae5d57c829f9dfe2378d07c3c6f68adec33fc5782c093406aaa44f5f35ea76db472fb78e SHA512 49fc4adbf6513b72381535f1fc541c39bc8fe369e583a3df610aab471251aff0189f7fcd66611ef6fa51146ef70c02704b70ca1d8c24db579817eedcb3797ec6
 DIST glibc-2.40.tar.xz 18752204 BLAKE2B 8593cab5b2549b77159b6866fbb40b917e491fd5bc0814f7f85b6529166d78d4583436450c479b86cdfe468304fc4d2a9ba8294230a55dbc4c15e89c3ab6c000 SHA512 33caf91dbfddde6480b7cdf7a68b36aff8c522bfee56160af26af297f1b768668edb08bc4e1a7ff61c64721e3c1d49c347a5dd01c5edd3b914ee6479c8b27885
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.40-r1.ebuild b/sys-libs/glibc/glibc-2.40-r1.ebuild
new file mode 100644
index 000000000000..bb266a4825ee
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.40-r1.ebuild
@@ -0,0 +1,1746 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=2
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+# Minimum systemd version needed (which contains any new syscall changes for
+# its seccomp filter!). Please double check this!
+MIN_SYSTEMD_VER="254.9-r1"
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 )"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+
+	# Fails regularly, unreliable
+	tst-valgrind-smoke
+
+	# https://sourceware.org/bugzilla/show_bug.cgi?id=31877 (bug #927973)
+	tst-shstk-legacy-1g
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
+		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
+		STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' \
+					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
+					| grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+
+		# Allow -O2 and -O3, but nothing else for now.
+		# TODO: Test -Os, -Oz.
+		if ! is-flagq '-O@(2|3)' ; then
+			# Lock glibc at -O2. We want to be conservative here.
+			filter-flags '-O?'
+			append-flags -O2
+		fi
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #798774
+	filter-flags -fno-semantic-interposition
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if ! use cet; then
+		case ${ABI}-${CTARGET} in
+			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
+				append-flags '-fcf-protection=none'
+				;;
+			arm64-aarch64*)
+				append-flags '-mbranch-protection=none'
+				;;
+		esac
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
+
+	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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP=${CPP}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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})"
+		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			ebegin "Checking if the system can execute 32-bit binaries"
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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 supporting IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	case ${ABI}-${CTARGET} in
+		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
+			"${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
+			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-09-10 10:01 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-09-10 10:01 UTC (permalink / raw
  To: gentoo-commits

commit:     1464aeb695ba671c0014dbad34aa75c3e2bc6beb
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 10 10:00:19 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Sep 10 10:00:27 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1464aeb6

sys-libs/glibc: keyword 2.40-r1 (patchset 2)

Patchset changelog 2.40-1..2.40-2
f61fca7a38 (HEAD -> gentoo/2.40, tag: gentoo/glibc-2.40-2, gentoo/gentoo/2.40) nptl: Use <support/check.h> facilities in tst-setuid3
0f60d4d989 posix: Use <support/check.h> facilities in tst-truncate and tst-truncate64
625f28f37c ungetc: Fix backup buffer leak on program exit [BZ #27821]
4348baff73 ungetc: Fix uninitialized read when putting into unused streams [BZ #27821]
4f306811cc Make tst-ungetc use libsupport
2341a365a1 stdio-common: Add test for vfscanf with matches longer than INT_MAX [BZ #27650]
9fe945b2c3 support: Add FAIL test failure helper
5a2286d324 string: strerror, strsignal cannot use buffer after dlmopen (bug 32026)
085b07a2a2 Define __libc_initial for the static libc
f18fdb2d5b x86: Fix bug in strchrnul-evex512 [BZ #32078]
1f0421b6f6 x32/cet: Support shadow stack during startup for Linux 6.10
ee3da9240a x86-64: Remove sysdeps/x86_64/x32/dl-machine.h
8278116368 support: Add options list terminator to the test driver
517c7bde24 manual/stdio: Further clarify putc, putwc, getc, and getwc
e76110d4a5 Fix name space violation in fortify wrappers (bug 32052)
19439efc69 x86: Tunables may incorrectly set Prefer_PMINUB_for_stringop (bug 32047)
fbc119618a resolv: Fix tst-resolv-short-response for older GCC (bug 32042)
c6405760ab Add mremap tests
838cc2d078 mremap: Update manual entry
b8a78f7355 linux: Update the mremap C implementation [BZ #31968]
b2e3445d1a Enhanced test coverage for strncmp, wcsncmp
c05d9a0887 Enhance test coverage for strnlen, wcsnlen
5a493d15d3 manual: make setrlimit() description less ambiguous
c8e7cf32af manual/stdio: Clarify putc and putwc
930bc483ea malloc: add multi-threaded tests for aligned_alloc/calloc/malloc
15cd292187 malloc: avoid global locks in tst-aligned_alloc-lib.c
e9eb3e67aa Fix version number in NEWS file
9b32dfa728 manual: Do not mention STATIC_TLS in dynamic linker hardening recommendations
ee6621db67 resolv: Do not wait for non-existing second DNS response after error (bug 30081)
5e27afbeef resolv: Allow short error responses to match any query (bug 31890)

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.40-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.40-r1.ebuild b/sys-libs/glibc/glibc-2.40-r1.ebuild
index bb266a4825ee..1c018dc68f75 100644
--- a/sys-libs/glibc/glibc-2.40-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.40-r1.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-09-11 23:56 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-09-11 23:56 UTC (permalink / raw
  To: gentoo-commits

commit:     554833754053065dfe4375f1523cb3f8bfdd3515
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 11 23:56:01 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Sep 11 23:56:34 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=55483375

sys-libs/glibc: add 2.40-r3, patchlevel 3, unkeyworded

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.40-r3.ebuild | 1746 +++++++++++++++++++++++++++++++++++
 2 files changed, 1747 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index ac12ffa2de99..99a53a13705b 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -27,6 +27,7 @@ DIST glibc-2.39-patches-9.tar.xz 110948 BLAKE2B b958561bbc0fefa5982f0aa16dd02cc9
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
 DIST glibc-2.40-patches-1.tar.xz 17316 BLAKE2B 7c44b9a6f1b34aa5240a1d68721acf399e488c2e9f6e838d16344f4e87737e516c975547fa23baba386263ccfdd26832df2e78040c95d0faa53b32e2343c9831 SHA512 5b922cb4a9150fc2380be834e2c6cf62340c23476e9e1ec6a7954e1f01686e8b6d65108a9a07a96d580b863376e0dfc829b6b4d3ac2a6f99de2fb87a51125d78
 DIST glibc-2.40-patches-2.tar.xz 48712 BLAKE2B ba98d7091e688b6469d2bbb7e1f077321b0976524b44ffaff28eb121ae5d57c829f9dfe2378d07c3c6f68adec33fc5782c093406aaa44f5f35ea76db472fb78e SHA512 49fc4adbf6513b72381535f1fc541c39bc8fe369e583a3df610aab471251aff0189f7fcd66611ef6fa51146ef70c02704b70ca1d8c24db579817eedcb3797ec6
+DIST glibc-2.40-patches-3.tar.xz 56044 BLAKE2B 79659397d36fb847cff01589489a90e36286dfe34c0e765fa05259518d8182d7e0f9666a577d699ef0c713071969bb0ec6358c1fbe053ba6cdc8828d08fdaa0b SHA512 5170a2912c7c5f5aa4513abc25402f419a5de56c477597e937b7920f0c652bca1704b4a4f74d12b960ee3bf4eb8985a98712c4dff485609047084caffffb0c95
 DIST glibc-2.40.tar.xz 18752204 BLAKE2B 8593cab5b2549b77159b6866fbb40b917e491fd5bc0814f7f85b6529166d78d4583436450c479b86cdfe468304fc4d2a9ba8294230a55dbc4c15e89c3ab6c000 SHA512 33caf91dbfddde6480b7cdf7a68b36aff8c522bfee56160af26af297f1b768668edb08bc4e1a7ff61c64721e3c1d49c347a5dd01c5edd3b914ee6479c8b27885
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.40-r3.ebuild b/sys-libs/glibc/glibc-2.40-r3.ebuild
new file mode 100644
index 000000000000..785b7411640f
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.40-r3.ebuild
@@ -0,0 +1,1746 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=3
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+# Minimum systemd version needed (which contains any new syscall changes for
+# its seccomp filter!). Please double check this!
+MIN_SYSTEMD_VER="254.9-r1"
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 )"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+
+	# Fails regularly, unreliable
+	tst-valgrind-smoke
+
+	# https://sourceware.org/bugzilla/show_bug.cgi?id=31877 (bug #927973)
+	tst-shstk-legacy-1g
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
+		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
+		STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' \
+					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
+					| grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+
+		# Allow -O2 and -O3, but nothing else for now.
+		# TODO: Test -Os, -Oz.
+		if ! is-flagq '-O@(2|3)' ; then
+			# Lock glibc at -O2. We want to be conservative here.
+			filter-flags '-O?'
+			append-flags -O2
+		fi
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #798774
+	filter-flags -fno-semantic-interposition
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if ! use cet; then
+		case ${ABI}-${CTARGET} in
+			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
+				append-flags '-fcf-protection=none'
+				;;
+			arm64-aarch64*)
+				append-flags '-mbranch-protection=none'
+				;;
+		esac
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
+
+	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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP=${CPP}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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})"
+		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			ebegin "Checking if the system can execute 32-bit binaries"
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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 supporting IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	case ${ABI}-${CTARGET} in
+		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
+			"${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
+			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-09-12 10:47 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-09-12 10:47 UTC (permalink / raw
  To: gentoo-commits

commit:     a8d1494169ddd40d6de2dac7188ceb645b83158c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 12 10:46:39 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Sep 12 10:46:58 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8d14941

sys-libs/glibc: keyword 2.40-r3 (patchlevel 3)

Patchset changelog 2.40-2..2.40-3
48794598ee (HEAD -> gentoo/2.40, tag: gentoo/glibc-2.40-3, gentoo/gentoo/2.40) libio: Attempt wide backup free only for non-legacy code
ecc5e6b022 debug: Fix read error handling in pcprofiledump
f6e7c79227 elf: Fix tst-dlopen-tlsreinit1.out test dependency
d03a00033e elf: Avoid re-initializing already allocated TLS in dlopen (bug 31717)
27eccbe4b5 elf: Clarify and invert second argument of _dl_allocate_tls_init

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.40-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.40-r3.ebuild b/sys-libs/glibc/glibc-2.40-r3.ebuild
index 785b7411640f..6891edbe8cab 100644
--- a/sys-libs/glibc/glibc-2.40-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.40-r3.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-09-12 22:08 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-09-12 22:08 UTC (permalink / raw
  To: gentoo-commits

commit:     4ee1b6526502e24a558a4f6454d3728e472e469c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 12 22:06:49 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Sep 12 22:08:10 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4ee1b652

sys-libs/glibc: drop -ia64 as ia64 is gone

It's been removed from Gentoo entirely so drop it from the comment.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 26a50c00fd1e..413d47b0d8f5 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa -ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-10-01 16:23 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-10-01 16:23 UTC (permalink / raw
  To: gentoo-commits

commit:     7b840b7e2d27e4e4ce83fdba6bd3424d1dde7648
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  1 16:21:11 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Oct  1 16:23:27 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b840b7e

sys-libs/glibc: add 2.40-r4, patchlevel 4 bump, no keywords

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.40-r4.ebuild | 1746 +++++++++++++++++++++++++++++++++++
 2 files changed, 1747 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index f1517abb416b..582c30ceef5e 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -25,6 +25,7 @@ DIST glibc-2.39-patches-6.tar.xz 87600 BLAKE2B 7bb24a16fb64ed07a7477dad075dfedd5
 DIST glibc-2.39-patches-9.tar.xz 110948 BLAKE2B b958561bbc0fefa5982f0aa16dd02cc9cbd015d30d203c02d9ee72605aa51c3e25fac39759487c0deb382a793e3e0274e5585c5a4bd0036bcfaa30fc7dad9021 SHA512 d954a846c4308d4e16d3e878f1ed9ec62f3d78328043289a38cb15148ccf6b431e4a0f185e138300c141ba7e63247922f916ecbab2c8eeaa99d31c54b1ebd0fb
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
 DIST glibc-2.40-patches-3.tar.xz 56044 BLAKE2B 79659397d36fb847cff01589489a90e36286dfe34c0e765fa05259518d8182d7e0f9666a577d699ef0c713071969bb0ec6358c1fbe053ba6cdc8828d08fdaa0b SHA512 5170a2912c7c5f5aa4513abc25402f419a5de56c477597e937b7920f0c652bca1704b4a4f74d12b960ee3bf4eb8985a98712c4dff485609047084caffffb0c95
+DIST glibc-2.40-patches-4.tar.xz 84180 BLAKE2B b64f9d75b8e85e1fa2f0cc685b4d34e9b23e790b57599586263210fa6981bacce31ed657b3921a8aec70fc5cb49676465fd237ed4c55a7116ba04fec4a06d667 SHA512 2efe04a4666540fb885c274f4d1aba4a91510c9dcaf2b9f2ad6316395691eb3458e27a2e4f12d45ea08335de58ef8e3895a3e32a603e6572d8179ffc32a66661
 DIST glibc-2.40.tar.xz 18752204 BLAKE2B 8593cab5b2549b77159b6866fbb40b917e491fd5bc0814f7f85b6529166d78d4583436450c479b86cdfe468304fc4d2a9ba8294230a55dbc4c15e89c3ab6c000 SHA512 33caf91dbfddde6480b7cdf7a68b36aff8c522bfee56160af26af297f1b768668edb08bc4e1a7ff61c64721e3c1d49c347a5dd01c5edd3b914ee6479c8b27885
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.40-r4.ebuild b/sys-libs/glibc/glibc-2.40-r4.ebuild
new file mode 100644
index 000000000000..5a117ed80c89
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.40-r4.ebuild
@@ -0,0 +1,1746 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=4
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+# Minimum systemd version needed (which contains any new syscall changes for
+# its seccomp filter!). Please double check this!
+MIN_SYSTEMD_VER="254.9-r1"
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 )"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+
+	# Fails regularly, unreliable
+	tst-valgrind-smoke
+
+	# https://sourceware.org/bugzilla/show_bug.cgi?id=31877 (bug #927973)
+	tst-shstk-legacy-1g
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
+		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
+		STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' \
+					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
+					| grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+
+		# Allow -O2 and -O3, but nothing else for now.
+		# TODO: Test -Os, -Oz.
+		if ! is-flagq '-O@(2|3)' ; then
+			# Lock glibc at -O2. We want to be conservative here.
+			filter-flags '-O?'
+			append-flags -O2
+		fi
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #798774
+	filter-flags -fno-semantic-interposition
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if ! use cet; then
+		case ${ABI}-${CTARGET} in
+			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
+				append-flags '-fcf-protection=none'
+				;;
+			arm64-aarch64*)
+				append-flags '-mbranch-protection=none'
+				;;
+		esac
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
+
+	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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP=${CPP}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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})"
+		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			ebegin "Checking if the system can execute 32-bit binaries"
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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 supporting IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	case ${ABI}-${CTARGET} in
+		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
+			"${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
+			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-10-01 16:23 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-10-01 16:23 UTC (permalink / raw
  To: gentoo-commits

commit:     4055832d125c11d31c69c406354c21d7c9f75a0f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  1 15:44:37 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Oct  1 16:23:24 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4055832d

sys-libs/glibc: drop 2.39-r7, 2.40, 2.40-r2

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    3 -
 sys-libs/glibc/glibc-2.39-r7.ebuild | 1750 -----------------------------------
 sys-libs/glibc/glibc-2.40-r2.ebuild | 1747 ----------------------------------
 sys-libs/glibc/glibc-2.40.ebuild    | 1746 ----------------------------------
 4 files changed, 5246 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 99a53a13705b..f1517abb416b 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -22,11 +22,8 @@ DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb8
 DIST glibc-2.38-patches-13.tar.xz 92708 BLAKE2B b2f05a793c92ea0b7901d2124fcd968fa846fdf687f8cbdbc17795c33fae2d538133fae66d575c5b98a7a05a29f9f816e7ecd45f3be5ed10ef65adbf92c7fc4d SHA512 24e45a88fa7676ef22a7e2bb864dff27262f69900c4ef76d21c6fee498d728949b6f5d03dd094d1774a66a8a47b779bf4b16ee31e5306bcdb55cedcc0a1c5e9f
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-2.39-patches-6.tar.xz 87600 BLAKE2B 7bb24a16fb64ed07a7477dad075dfedd59ab8d0d4ab3032273684405fd690a863a84fe1f859a07faab3ccd4663ba4f896ca37303cf2a4658ab1662732c50e860 SHA512 d48de19e9e33ef334cdbd63b6ceaddff12424477193f6bb0876105e193f2aba44cb48c33aebc47546db76dc229849cc22f884a68971bbc23994769b64bcd345c
-DIST glibc-2.39-patches-7.tar.xz 104640 BLAKE2B 9dba666c20aa4f4dde29fcc7173e53f08037102d0e53634533ac900f90d99a76f0f26064f6f71c72c75fa788f501e562a9f9548ebb44ded26ec55a5344e99d1e SHA512 214bf3256177141e059531775ed74d813a01a1e4f15892c40f7e70d8b26ce79216501d1cee5e6e980fbb5c2966ce427edf3136283486ae50acb88cb8e647ee0a
 DIST glibc-2.39-patches-9.tar.xz 110948 BLAKE2B b958561bbc0fefa5982f0aa16dd02cc9cbd015d30d203c02d9ee72605aa51c3e25fac39759487c0deb382a793e3e0274e5585c5a4bd0036bcfaa30fc7dad9021 SHA512 d954a846c4308d4e16d3e878f1ed9ec62f3d78328043289a38cb15148ccf6b431e4a0f185e138300c141ba7e63247922f916ecbab2c8eeaa99d31c54b1ebd0fb
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
-DIST glibc-2.40-patches-1.tar.xz 17316 BLAKE2B 7c44b9a6f1b34aa5240a1d68721acf399e488c2e9f6e838d16344f4e87737e516c975547fa23baba386263ccfdd26832df2e78040c95d0faa53b32e2343c9831 SHA512 5b922cb4a9150fc2380be834e2c6cf62340c23476e9e1ec6a7954e1f01686e8b6d65108a9a07a96d580b863376e0dfc829b6b4d3ac2a6f99de2fb87a51125d78
-DIST glibc-2.40-patches-2.tar.xz 48712 BLAKE2B ba98d7091e688b6469d2bbb7e1f077321b0976524b44ffaff28eb121ae5d57c829f9dfe2378d07c3c6f68adec33fc5782c093406aaa44f5f35ea76db472fb78e SHA512 49fc4adbf6513b72381535f1fc541c39bc8fe369e583a3df610aab471251aff0189f7fcd66611ef6fa51146ef70c02704b70ca1d8c24db579817eedcb3797ec6
 DIST glibc-2.40-patches-3.tar.xz 56044 BLAKE2B 79659397d36fb847cff01589489a90e36286dfe34c0e765fa05259518d8182d7e0f9666a577d699ef0c713071969bb0ec6358c1fbe053ba6cdc8828d08fdaa0b SHA512 5170a2912c7c5f5aa4513abc25402f419a5de56c477597e937b7920f0c652bca1704b4a4f74d12b960ee3bf4eb8985a98712c4dff485609047084caffffb0c95
 DIST glibc-2.40.tar.xz 18752204 BLAKE2B 8593cab5b2549b77159b6866fbb40b917e491fd5bc0814f7f85b6529166d78d4583436450c479b86cdfe468304fc4d2a9ba8294230a55dbc4c15e89c3ab6c000 SHA512 33caf91dbfddde6480b7cdf7a68b36aff8c522bfee56160af26af297f1b768668edb08bc4e1a7ff61c64721e3c1d49c347a5dd01c5edd3b914ee6479c8b27885
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238

diff --git a/sys-libs/glibc/glibc-2.39-r7.ebuild b/sys-libs/glibc/glibc-2.39-r7.ebuild
deleted file mode 100644
index f8c05e930e61..000000000000
--- a/sys-libs/glibc/glibc-2.39-r7.ebuild
+++ /dev/null
@@ -1,1750 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..12} )
-TMPFILES_OPTIONAL=1
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=7
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-# Minimum systemd version needed (which contains any new syscall changes for
-# its seccomp filter!). Please double check this!
-MIN_SYSTEMD_VER="254.9-r1"
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 )"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# - similarly, valgrind requires knowledge about symbols in ld.so:
-#	bug #920753
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-
-	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
-	tst-sched1
-
-	# Fails regularly, unreliable
-	tst-valgrind-smoke
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
-		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
-		STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' \
-					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
-					| grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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.
-				# Need to save/restore CC because earlier on, we stuff it full of CFLAGS, and tc-getCPP doesn't like that.
-				CC_mangled=${CC}
-				CC=${glibc__GLIBC_CC}
-				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
-				CC=${CC_mangled}
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-
-		# Allow -O2 and -O3, but nothing else for now.
-		# TODO: Test -Os, -Oz.
-		if ! is-flagq '-O@(2|3)' ; then
-			# Lock glibc at -O2. We want to be conservative here.
-			filter-flags '-O?'
-			append-flags -O2
-		fi
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if ! use cet; then
-		case ${ABI}-${CTARGET} in
-			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
-				append-flags '-fcf-protection=none'
-				;;
-			arm64-aarch64*)
-				append-flags '-mbranch-protection=none'
-				;;
-		esac
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# glibc does not work with non-bfd (for various reasons):
-	# * gold (bug #269274)
-	# * mold (bug #860900)
-	tc-ld-force-bfd
-
-	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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-	export glibc__ORIG_CPP=${CPP}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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})"
-		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-	export glibc__GLIBC_CPP=${CPP}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking if the system can execute 32-bit binaries"
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			if [[ $STAT -ne 0 ]]; then
-				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
-				eerror "Seek support otherwise."
-				die "Unable to execute 32-bit binaries"
-			fi
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	case ${ABI}-${CTARGET} in
-		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-		if [[ "$(nice)" == "19" ]] ; then
-			# Expects to be able to increase niceness, which it can't do if
-			# already at the highest nice value
-			XFAIL_TEST_LIST+=( "tst-nice" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	# valgrind requires knowledge about ld.so symbols.
-	dostrip -x $(alt_libdir)/ld-*.so*
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
-			"${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
-			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.40-r2.ebuild b/sys-libs/glibc/glibc-2.40-r2.ebuild
deleted file mode 100644
index a81158564242..000000000000
--- a/sys-libs/glibc/glibc-2.40-r2.ebuild
+++ /dev/null
@@ -1,1747 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..12} )
-TMPFILES_OPTIONAL=1
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=2
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-# Minimum systemd version needed (which contains any new syscall changes for
-# its seccomp filter!). Please double check this!
-MIN_SYSTEMD_VER="254.9-r1"
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 )"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# - similarly, valgrind requires knowledge about symbols in ld.so:
-#	bug #920753
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-
-	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
-	tst-sched1
-
-	# Fails regularly, unreliable
-	tst-valgrind-smoke
-
-	# https://sourceware.org/bugzilla/show_bug.cgi?id=31877 (bug #927973)
-	tst-shstk-legacy-1g
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
-		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
-		STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' \
-					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
-					| grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-
-		# Allow -O2 and -O3, but nothing else for now.
-		# TODO: Test -Os, -Oz.
-		if ! is-flagq '-O@(2|3)' ; then
-			# Lock glibc at -O2. We want to be conservative here.
-			filter-flags '-O?'
-			append-flags -O2
-		fi
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #798774
-	filter-flags -fno-semantic-interposition
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if ! use cet; then
-		case ${ABI}-${CTARGET} in
-			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
-				append-flags '-fcf-protection=none'
-				;;
-			arm64-aarch64*)
-				append-flags '-mbranch-protection=none'
-				;;
-		esac
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# glibc does not work with non-bfd (for various reasons):
-	# * gold (bug #269274)
-	# * mold (bug #860900)
-	tc-ld-force-bfd
-
-	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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-	export glibc__ORIG_CPP=${CPP}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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})"
-		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-	export glibc__GLIBC_CPP=${CPP}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking if the system can execute 32-bit binaries"
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			if [[ $STAT -ne 0 ]]; then
-				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
-				eerror "Seek support otherwise."
-				die "Unable to execute 32-bit binaries"
-			fi
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		eapply "${FILESDIR}"/${P}-libio-legacy.patch
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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 supporting IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	case ${ABI}-${CTARGET} in
-		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-		if [[ "$(nice)" == "19" ]] ; then
-			# Expects to be able to increase niceness, which it can't do if
-			# already at the highest nice value
-			XFAIL_TEST_LIST+=( "tst-nice" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	# valgrind requires knowledge about ld.so symbols.
-	dostrip -x $(alt_libdir)/ld-*.so*
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
-			"${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
-			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.40.ebuild b/sys-libs/glibc/glibc-2.40.ebuild
deleted file mode 100644
index 06d8ace60926..000000000000
--- a/sys-libs/glibc/glibc-2.40.ebuild
+++ /dev/null
@@ -1,1746 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..12} )
-TMPFILES_OPTIONAL=1
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=1
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-# Minimum systemd version needed (which contains any new syscall changes for
-# its seccomp filter!). Please double check this!
-MIN_SYSTEMD_VER="254.9-r1"
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 )"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# - similarly, valgrind requires knowledge about symbols in ld.so:
-#	bug #920753
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-
-	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
-	tst-sched1
-
-	# Fails regularly, unreliable
-	tst-valgrind-smoke
-
-	# https://sourceware.org/bugzilla/show_bug.cgi?id=31877 (bug #927973)
-	tst-shstk-legacy-1g
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
-		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
-		STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' \
-					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
-					| grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-
-		# Allow -O2 and -O3, but nothing else for now.
-		# TODO: Test -Os, -Oz.
-		if ! is-flagq '-O@(2|3)' ; then
-			# Lock glibc at -O2. We want to be conservative here.
-			filter-flags '-O?'
-			append-flags -O2
-		fi
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #798774
-	filter-flags -fno-semantic-interposition
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if ! use cet; then
-		case ${ABI}-${CTARGET} in
-			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
-				append-flags '-fcf-protection=none'
-				;;
-			arm64-aarch64*)
-				append-flags '-mbranch-protection=none'
-				;;
-		esac
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# glibc does not work with non-bfd (for various reasons):
-	# * gold (bug #269274)
-	# * mold (bug #860900)
-	tc-ld-force-bfd
-
-	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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-	export glibc__ORIG_CPP=${CPP}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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})"
-		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-	export glibc__GLIBC_CPP=${CPP}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking if the system can execute 32-bit binaries"
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			if [[ $STAT -ne 0 ]]; then
-				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
-				eerror "Seek support otherwise."
-				die "Unable to execute 32-bit binaries"
-			fi
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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 supporting IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	case ${ABI}-${CTARGET} in
-		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-		if [[ "$(nice)" == "19" ]] ; then
-			# Expects to be able to increase niceness, which it can't do if
-			# already at the highest nice value
-			XFAIL_TEST_LIST+=( "tst-nice" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	# valgrind requires knowledge about ld.so symbols.
-	dostrip -x $(alt_libdir)/ld-*.so*
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
-			"${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
-			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-10-03  9:29 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-10-03  9:29 UTC (permalink / raw
  To: gentoo-commits

commit:     524533f998dc72aae8dea2efd48605ac6641d5f6
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Oct  3 09:28:38 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Oct  3 09:29:46 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=524533f9

sys-libs/glibc: keyword 2.40-r4 (patchlevel 4)

Patchset changelog 2.40-3..2.40-4
13f300db19 (HEAD -> gentoo/2.40, tag: gentoo/glibc-2.40-4, gentoo/gentoo/2.40) Add tests of more strtod special cases
22cf443311 Add more tests of strtod end pointer
3a11e0d9b6 Make tst-strtod2 and tst-strtod5 type-generic
5abd2245d1 powerpc64le: Build new strtod tests with long double ABI flags (bug 32145)
b55e3916d4 Do not set errno for overflowing NaN payload in strtod/nan (bug 32045)
7072204c71 Improve NaN payload testing
5123498d4c Make __strtod_internal tests type-generic
a69bbf8a0a Fix strtod subnormal rounding (bug 30220)
56e69c9838 More thoroughly test underflow / errno in tst-strtod-round
c30590f4f7 Test errno setting on strtod overflow in tst-strtod-round
87339c42f1 Add tests of fread
40c85aaef4 stdio-common: Add new test for fdopen

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.40-r4.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.40-r4.ebuild b/sys-libs/glibc/glibc-2.40-r4.ebuild
index 5a117ed80c89..7f264d20c919 100644
--- a/sys-libs/glibc/glibc-2.40-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.40-r4.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-10-03 12:35 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-10-03 12:35 UTC (permalink / raw
  To: gentoo-commits

commit:     05fd6610da6c39193e0ec3d614647f9d3f2443eb
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Oct  3 12:34:39 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Oct  3 12:35:46 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=05fd6610

sys-libs/glibc: add glibc-2.39-r10 (patchlevel 10, no keywords)

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    1 +
 sys-libs/glibc/glibc-2.39-r10.ebuild | 1746 ++++++++++++++++++++++++++++++++++
 2 files changed, 1747 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 582c30ceef5e..d17e64f5c491 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -21,6 +21,7 @@ DIST glibc-2.37-patches-12.tar.xz 83716 BLAKE2B 123951d94dad6c22150c4ef2299bcaaf
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-13.tar.xz 92708 BLAKE2B b2f05a793c92ea0b7901d2124fcd968fa846fdf687f8cbdbc17795c33fae2d538133fae66d575c5b98a7a05a29f9f816e7ecd45f3be5ed10ef65adbf92c7fc4d SHA512 24e45a88fa7676ef22a7e2bb864dff27262f69900c4ef76d21c6fee498d728949b6f5d03dd094d1774a66a8a47b779bf4b16ee31e5306bcdb55cedcc0a1c5e9f
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
+DIST glibc-2.39-patches-10.tar.xz 193260 BLAKE2B be13f61b1380cda005ef877e6c329b2d042e756b85b4711c502495074d28af35a2a4998641e2a317888105d260e0ec5c6a7f2cbdd1e68fd9ff95f88d680616d6 SHA512 8df0f9181c9129fda4e84d46ccd0bd0c6f8ecec93c0c702830b02241d001f973351187a1299dc905685907ffda6b3605043ccfd1c08fd92d7e5c358070a760d0
 DIST glibc-2.39-patches-6.tar.xz 87600 BLAKE2B 7bb24a16fb64ed07a7477dad075dfedd59ab8d0d4ab3032273684405fd690a863a84fe1f859a07faab3ccd4663ba4f896ca37303cf2a4658ab1662732c50e860 SHA512 d48de19e9e33ef334cdbd63b6ceaddff12424477193f6bb0876105e193f2aba44cb48c33aebc47546db76dc229849cc22f884a68971bbc23994769b64bcd345c
 DIST glibc-2.39-patches-9.tar.xz 110948 BLAKE2B b958561bbc0fefa5982f0aa16dd02cc9cbd015d30d203c02d9ee72605aa51c3e25fac39759487c0deb382a793e3e0274e5585c5a4bd0036bcfaa30fc7dad9021 SHA512 d954a846c4308d4e16d3e878f1ed9ec62f3d78328043289a38cb15148ccf6b431e4a0f185e138300c141ba7e63247922f916ecbab2c8eeaa99d31c54b1ebd0fb
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2

diff --git a/sys-libs/glibc/glibc-2.39-r10.ebuild b/sys-libs/glibc/glibc-2.39-r10.ebuild
new file mode 100644
index 000000000000..566c8862784f
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.39-r10.ebuild
@@ -0,0 +1,1746 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=10
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+# Minimum systemd version needed (which contains any new syscall changes for
+# its seccomp filter!). Please double check this!
+MIN_SYSTEMD_VER="254.9-r1"
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 )"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+
+	# Fails regularly, unreliable
+	tst-valgrind-smoke
+
+	# https://sourceware.org/bugzilla/show_bug.cgi?id=31877 (bug #927973)
+	tst-shstk-legacy-1g
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
+		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
+		STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' \
+					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
+					| grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+
+		# Allow -O2 and -O3, but nothing else for now.
+		# TODO: Test -Os, -Oz.
+		if ! is-flagq '-O@(2|3)' ; then
+			# Lock glibc at -O2. We want to be conservative here.
+			filter-flags '-O?'
+			append-flags -O2
+		fi
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #798774
+	filter-flags -fno-semantic-interposition
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if ! use cet; then
+		case ${ABI}-${CTARGET} in
+			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
+				append-flags '-fcf-protection=none'
+				;;
+			arm64-aarch64*)
+				append-flags '-mbranch-protection=none'
+				;;
+		esac
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
+
+	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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP=${CPP}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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})"
+		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			ebegin "Checking if the system can execute 32-bit binaries"
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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 supporting IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	case ${ABI}-${CTARGET} in
+		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
+			"${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
+			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-10-03 16:43 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-10-03 16:43 UTC (permalink / raw
  To: gentoo-commits

commit:     913d3074d15a3e615c56c92c8eb68219c6ee3df1
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Oct  3 16:40:41 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Oct  3 16:43:04 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=913d3074

sys-libs/glibc: keyword 2.39-r10 (patchlevel 10)

Patchset changelog 2.39-9..2.39-10
9afc9ff64c (HEAD -> gentoo/2.39, tag: gentoo/glibc-2.39-10, gentoo/gentoo/2.39) Add crt1-2.0.o for glibc 2.0 compatibility tests
1bd9d68c1d Add tests of more strtod special cases
32fae6b6eb Add more tests of strtod end pointer
5d8d22cfad Make tst-strtod2 and tst-strtod5 type-generic
bdd9526cfb powerpc64le: Build new strtod tests with long double ABI flags (bug 32145)
945440575a Do not set errno for overflowing NaN payload in strtod/nan (bug 32045)
4903083a27 Improve NaN payload testing
415885d830 Make __strtod_internal tests type-generic
6002a0172d Fix strtod subnormal rounding (bug 30220)
48ecf88f33 More thoroughly test underflow / errno in tst-strtod-round
38212bc08d Test errno setting on strtod overflow in tst-strtod-round
1b3437253d Add tests of fread
b837a4a745 stdio-common: Add new test for fdopen
48ec7c84fd libio: Attempt wide backup free only for non-legacy code
78d80aec41 debug: Fix read error handling in pcprofiledump
e6bdaf4343 elf: Fix tst-dlopen-tlsreinit1.out test dependency
5dcdafc11a elf: Avoid re-initializing already allocated TLS in dlopen (bug 31717)
3267048ca4 elf: Clarify and invert second argument of _dl_allocate_tls_init
52a1a29ed9 elf: Support recursive use of dynamic TLS in interposed malloc
a2dffe57fc nptl: Use <support/check.h> facilities in tst-setuid3
63dfb14109 posix: Use <support/check.h> facilities in tst-truncate and tst-truncate64
30757f5b1a ungetc: Fix backup buffer leak on program exit [BZ #27821]
25fdaf29cd ungetc: Fix uninitialized read when putting into unused streams [BZ #27821]
3ec699a3dd Make tst-ungetc use libsupport
9eadda99f4 stdio-common: Add test for vfscanf with matches longer than INT_MAX [BZ #27650]
764e8c7d71 support: Add FAIL test failure helper
33b00de3f0 string: strerror, strsignal cannot use buffer after dlmopen (bug 32026)
6d433cecb9 Define __libc_initial for the static libc
e8b86bd43e x86: Fix bug in strchrnul-evex512 [BZ #32078]
9bf3430af7 Adjust check-local-headers test for libaudit 4.0
000302667c x32/cet: Support shadow stack during startup for Linux 6.10
d43f6bf466 x86-64: Remove sysdeps/x86_64/x32/dl-machine.h
03e7cec1df support: Add options list terminator to the test driver
42e063bdb3 manual/stdio: Further clarify putc, putwc, getc, and getwc
9270140f6e Fix name space violation in fortify wrappers (bug 32052)
3e0c4a5b07 resolv: Fix tst-resolv-short-response for older GCC (bug 32042)
a0c0858e90 Add mremap tests
3cf06945a1 mremap: Update manual entry
31d4fda31a linux: Update the mremap C implementation [BZ #31968]
b9f9e8114e Enhanced test coverage for strncmp, wcsncmp
212ec8cc11 Enhance test coverage for strnlen, wcsnlen
e5c937e217 manual: make setrlimit() description less ambiguous
db5342b9c4 manual/stdio: Clarify putc and putwc
73237341e7 malloc: add multi-threaded tests for aligned_alloc/calloc/malloc
5ea3ef3154 malloc: avoid global locks in tst-aligned_alloc-lib.c
10b2326c04 resolv: Track single-request fallback via _res._flags (bug 31476)
f912819c8c resolv: Do not wait for non-existing second DNS response after error (bug 30081)
2be118ead4 resolv: Allow short error responses to match any query (bug 31890)
e77708dfc2 elf: Fix localplt.awk for DT_RELR-enabled builds (BZ 31978)
0b880f45c2 Fix usage of _STACK_GROWS_DOWN and _STACK_GROWS_UP defines [BZ 31989]
6ba7f7f775 Linux: Make __rseq_size useful for feature detection (bug 31965)
139f79d2e9 elf: Make dl-rseq-symbols Linux only
294a9dcabb nptl: fix potential merge of __rseq_* relro symbols
2ee7d972c6 s390x: Fix segfault in wcsncmp [BZ #31934]
8854645e44 stdlib: fix arc4random fallback to /dev/urandom (BZ 31612)
5ed18d08d7 math: Provide missing math symbols on libc.a (BZ 31781)
598705a328 math: Fix isnanf128 static build (BZ 31774)
464c9a4553 math: Fix i386 and m68k exp10 on static build (BZ 31775)
268bc1b127 math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488)
ae5d0f5521 posix: Fix pidfd_spawn/pidfd_spawnp leak if execve fails (BZ 31695)
413b0bd421 Linux: Include <dl-symbol-redir-ifunc.h> in dl-sysdep.c
3500c9b621 NEWS: update list of fixed CVEs in 2.39
d9c79eece1 NEWS: update list of fixed bugs in 2.39
e3418a7e46 localedata: ssy_ER: Fix syntax error

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r10.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r10.ebuild b/sys-libs/glibc/glibc-2.39-r10.ebuild
index 566c8862784f..ed17d3d931d1 100644
--- a/sys-libs/glibc/glibc-2.39-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r10.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-10-07 15:56 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-10-07 15:56 UTC (permalink / raw
  To: gentoo-commits

commit:     fbe427b18343c5ad45bc2fd56ae691f1c95295ff
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Oct  7 15:53:11 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Oct  7 15:54:58 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fbe427b1

sys-libs/glibc: filter -Wl,--gc-sections

This fails to link when building static-reloc.o but it's broken in other
ways too -- amonakov points out that glibc's linker scripts aren't
ready for gc-sections (odd runtime side-effects like I/O flushing at exit
not occurring), see PR21557 comment 0 for it being mentioned as an aside.

Thanks to holgerh for reporting.

Closes: https://bugs.gentoo.org/940709
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r3.ebuild  | 5 +++++
 sys-libs/glibc/glibc-2.31-r7.ebuild  | 5 +++++
 sys-libs/glibc/glibc-2.32-r8.ebuild  | 5 +++++
 sys-libs/glibc/glibc-2.33-r14.ebuild | 5 +++++
 sys-libs/glibc/glibc-2.34-r14.ebuild | 5 +++++
 sys-libs/glibc/glibc-2.35-r11.ebuild | 5 +++++
 sys-libs/glibc/glibc-2.36-r8.ebuild  | 5 +++++
 sys-libs/glibc/glibc-2.37-r10.ebuild | 5 +++++
 sys-libs/glibc/glibc-2.38-r13.ebuild | 5 +++++
 sys-libs/glibc/glibc-2.39-r10.ebuild | 5 +++++
 sys-libs/glibc/glibc-2.39-r6.ebuild  | 5 +++++
 sys-libs/glibc/glibc-2.39-r9.ebuild  | 5 +++++
 sys-libs/glibc/glibc-2.40-r3.ebuild  | 5 +++++
 sys-libs/glibc/glibc-2.40-r4.ebuild  | 5 +++++
 sys-libs/glibc/glibc-9999.ebuild     | 5 +++++
 15 files changed, 75 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.19-r3.ebuild b/sys-libs/glibc/glibc-2.19-r3.ebuild
index c0f528d06063..7d492b72364a 100644
--- a/sys-libs/glibc/glibc-2.19-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r3.ebuild
@@ -346,6 +346,11 @@ setup_flags() {
 	# glibc aborts if rpath is set by LDFLAGS
 	filter-ldflags '-Wl,-rpath=*'
 
+	# Fails to link (bug #940709) in some cases but even if it manages to,
+	# subtle runtime breakage will occur because the linker scripts need
+	# adaptation. Mentioned in PR21557#c0.
+	filter-ldflags '-Wl,--gc-sections'
+
 	# #492892
 	filter-flags -frecord-gcc-switches
 

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild b/sys-libs/glibc/glibc-2.31-r7.ebuild
index 0c3ee20d2b3e..7df8f5816447 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -378,6 +378,11 @@ setup_flags() {
 	# glibc aborts if rpath is set by LDFLAGS
 	filter-ldflags '-Wl,-rpath=*'
 
+	# Fails to link (bug #940709) in some cases but even if it manages to,
+	# subtle runtime breakage will occur because the linker scripts need
+	# adaptation. Mentioned in PR21557#c0.
+	filter-ldflags '-Wl,--gc-sections'
+
 	# #492892
 	filter-flags -frecord-gcc-switches
 

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild b/sys-libs/glibc/glibc-2.32-r8.ebuild
index e787a3de2ef7..656ad5161a27 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -395,6 +395,11 @@ setup_flags() {
 	# glibc aborts if rpath is set by LDFLAGS
 	filter-ldflags '-Wl,-rpath=*'
 
+	# Fails to link (bug #940709) in some cases but even if it manages to,
+	# subtle runtime breakage will occur because the linker scripts need
+	# adaptation. Mentioned in PR21557#c0.
+	filter-ldflags '-Wl,--gc-sections'
+
 	# #492892
 	filter-flags -frecord-gcc-switches
 

diff --git a/sys-libs/glibc/glibc-2.33-r14.ebuild b/sys-libs/glibc/glibc-2.33-r14.ebuild
index ca3fb42335ea..5e23df0069e8 100644
--- a/sys-libs/glibc/glibc-2.33-r14.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r14.ebuild
@@ -411,6 +411,11 @@ setup_flags() {
 	# https://sourceware.org/PR27837
 	filter-ldflags '-Wl,--relax'
 
+	# Fails to link (bug #940709) in some cases but even if it manages to,
+	# subtle runtime breakage will occur because the linker scripts need
+	# adaptation. Mentioned in PR21557#c0.
+	filter-ldflags '-Wl,--gc-sections'
+
 	# #492892
 	filter-flags -frecord-gcc-switches
 

diff --git a/sys-libs/glibc/glibc-2.34-r14.ebuild b/sys-libs/glibc/glibc-2.34-r14.ebuild
index 3a2d7ac313da..e23b9ae35e9c 100644
--- a/sys-libs/glibc/glibc-2.34-r14.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r14.ebuild
@@ -415,6 +415,11 @@ setup_flags() {
 	# https://sourceware.org/PR27837
 	filter-ldflags '-Wl,--relax'
 
+	# Fails to link (bug #940709) in some cases but even if it manages to,
+	# subtle runtime breakage will occur because the linker scripts need
+	# adaptation. Mentioned in PR21557#c0.
+	filter-ldflags '-Wl,--gc-sections'
+
 	# #492892
 	filter-flags -frecord-gcc-switches
 

diff --git a/sys-libs/glibc/glibc-2.35-r11.ebuild b/sys-libs/glibc/glibc-2.35-r11.ebuild
index e51499d04e05..0c2aec0025e0 100644
--- a/sys-libs/glibc/glibc-2.35-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r11.ebuild
@@ -428,6 +428,11 @@ setup_flags() {
 	# https://sourceware.org/PR27837
 	filter-ldflags '-Wl,--relax'
 
+	# Fails to link (bug #940709) in some cases but even if it manages to,
+	# subtle runtime breakage will occur because the linker scripts need
+	# adaptation. Mentioned in PR21557#c0.
+	filter-ldflags '-Wl,--gc-sections'
+
 	# #492892
 	filter-flags -frecord-gcc-switches
 

diff --git a/sys-libs/glibc/glibc-2.36-r8.ebuild b/sys-libs/glibc/glibc-2.36-r8.ebuild
index 471ede5408d3..cb6ddba38eb7 100644
--- a/sys-libs/glibc/glibc-2.36-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r8.ebuild
@@ -434,6 +434,11 @@ setup_flags() {
 	# https://sourceware.org/PR27837
 	filter-ldflags '-Wl,--relax'
 
+	# Fails to link (bug #940709) in some cases but even if it manages to,
+	# subtle runtime breakage will occur because the linker scripts need
+	# adaptation. Mentioned in PR21557#c0.
+	filter-ldflags '-Wl,--gc-sections'
+
 	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
 	# we have to do that here already so mips can filter it out again :P
 	if use hash-sysv-compat ; then

diff --git a/sys-libs/glibc/glibc-2.37-r10.ebuild b/sys-libs/glibc/glibc-2.37-r10.ebuild
index e5de30df953c..e323ee8ae32d 100644
--- a/sys-libs/glibc/glibc-2.37-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r10.ebuild
@@ -449,6 +449,11 @@ setup_flags() {
 	# https://sourceware.org/PR27837
 	filter-ldflags '-Wl,--relax'
 
+	# Fails to link (bug #940709) in some cases but even if it manages to,
+	# subtle runtime breakage will occur because the linker scripts need
+	# adaptation. Mentioned in PR21557#c0.
+	filter-ldflags '-Wl,--gc-sections'
+
 	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
 	# we have to do that here already so mips can filter it out again :P
 	if use hash-sysv-compat ; then

diff --git a/sys-libs/glibc/glibc-2.38-r13.ebuild b/sys-libs/glibc/glibc-2.38-r13.ebuild
index 01d2fa89a416..5bba661e9e91 100644
--- a/sys-libs/glibc/glibc-2.38-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r13.ebuild
@@ -454,6 +454,11 @@ setup_flags() {
 	# anyway because glibc already handles this by itself.
 	filter-ldflags '-Wl,--dynamic-linker=*'
 
+	# Fails to link (bug #940709) in some cases but even if it manages to,
+	# subtle runtime breakage will occur because the linker scripts need
+	# adaptation. Mentioned in PR21557#c0.
+	filter-ldflags '-Wl,--gc-sections'
+
 	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
 	# we have to do that here already so mips can filter it out again :P
 	if use hash-sysv-compat ; then

diff --git a/sys-libs/glibc/glibc-2.39-r10.ebuild b/sys-libs/glibc/glibc-2.39-r10.ebuild
index ed17d3d931d1..ab91a718940c 100644
--- a/sys-libs/glibc/glibc-2.39-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r10.ebuild
@@ -465,6 +465,11 @@ setup_flags() {
 	# anyway because glibc already handles this by itself.
 	filter-ldflags '-Wl,--dynamic-linker=*'
 
+	# Fails to link (bug #940709) in some cases but even if it manages to,
+	# subtle runtime breakage will occur because the linker scripts need
+	# adaptation. Mentioned in PR21557#c0.
+	filter-ldflags '-Wl,--gc-sections'
+
 	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
 	# we have to do that here already so mips can filter it out again :P
 	if use hash-sysv-compat ; then

diff --git a/sys-libs/glibc/glibc-2.39-r6.ebuild b/sys-libs/glibc/glibc-2.39-r6.ebuild
index 2c6ad99b5569..d6ca7cba9e5b 100644
--- a/sys-libs/glibc/glibc-2.39-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r6.ebuild
@@ -472,6 +472,11 @@ setup_flags() {
 	# anyway because glibc already handles this by itself.
 	filter-ldflags '-Wl,--dynamic-linker=*'
 
+	# Fails to link (bug #940709) in some cases but even if it manages to,
+	# subtle runtime breakage will occur because the linker scripts need
+	# adaptation. Mentioned in PR21557#c0.
+	filter-ldflags '-Wl,--gc-sections'
+
 	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
 	# we have to do that here already so mips can filter it out again :P
 	if use hash-sysv-compat ; then

diff --git a/sys-libs/glibc/glibc-2.39-r9.ebuild b/sys-libs/glibc/glibc-2.39-r9.ebuild
index 2f0b1d9a004d..e0df00dcd639 100644
--- a/sys-libs/glibc/glibc-2.39-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r9.ebuild
@@ -465,6 +465,11 @@ setup_flags() {
 	# anyway because glibc already handles this by itself.
 	filter-ldflags '-Wl,--dynamic-linker=*'
 
+	# Fails to link (bug #940709) in some cases but even if it manages to,
+	# subtle runtime breakage will occur because the linker scripts need
+	# adaptation. Mentioned in PR21557#c0.
+	filter-ldflags '-Wl,--gc-sections'
+
 	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
 	# we have to do that here already so mips can filter it out again :P
 	if use hash-sysv-compat ; then

diff --git a/sys-libs/glibc/glibc-2.40-r3.ebuild b/sys-libs/glibc/glibc-2.40-r3.ebuild
index 038ecf46f641..a33b62687f2e 100644
--- a/sys-libs/glibc/glibc-2.40-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.40-r3.ebuild
@@ -465,6 +465,11 @@ setup_flags() {
 	# anyway because glibc already handles this by itself.
 	filter-ldflags '-Wl,--dynamic-linker=*'
 
+	# Fails to link (bug #940709) in some cases but even if it manages to,
+	# subtle runtime breakage will occur because the linker scripts need
+	# adaptation. Mentioned in PR21557#c0.
+	filter-ldflags '-Wl,--gc-sections'
+
 	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
 	# we have to do that here already so mips can filter it out again :P
 	if use hash-sysv-compat ; then

diff --git a/sys-libs/glibc/glibc-2.40-r4.ebuild b/sys-libs/glibc/glibc-2.40-r4.ebuild
index 56088868f4f3..d4fc0765e8cc 100644
--- a/sys-libs/glibc/glibc-2.40-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.40-r4.ebuild
@@ -465,6 +465,11 @@ setup_flags() {
 	# anyway because glibc already handles this by itself.
 	filter-ldflags '-Wl,--dynamic-linker=*'
 
+	# Fails to link (bug #940709) in some cases but even if it manages to,
+	# subtle runtime breakage will occur because the linker scripts need
+	# adaptation. Mentioned in PR21557#c0.
+	filter-ldflags '-Wl,--gc-sections'
+
 	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
 	# we have to do that here already so mips can filter it out again :P
 	if use hash-sysv-compat ; then

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index aa6d07cbace3..dee2d1b66c49 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -465,6 +465,11 @@ setup_flags() {
 	# anyway because glibc already handles this by itself.
 	filter-ldflags '-Wl,--dynamic-linker=*'
 
+	# Fails to link (bug #940709) in some cases but even if it manages to,
+	# subtle runtime breakage will occur because the linker scripts need
+	# adaptation. Mentioned in PR21557#c0.
+	filter-ldflags '-Wl,--gc-sections'
+
 	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
 	# we have to do that here already so mips can filter it out again :P
 	if use hash-sysv-compat ; then


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-10-09  6:57 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-10-09  6:57 UTC (permalink / raw
  To: gentoo-commits

commit:     a0fd42e01166802135d706e534cb1441ed1b0d49
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  9 06:55:01 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Oct  9 06:57:12 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a0fd42e0

sys-libs/glibc: add glibc-2.40-r5 (patchlevel 5)

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 +
 sys-libs/glibc/glibc-2.40-r5.ebuild | 1751 +++++++++++++++++++++++++++++++++++
 2 files changed, 1752 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index d17e64f5c491..03dad97ee95b 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -27,6 +27,7 @@ DIST glibc-2.39-patches-9.tar.xz 110948 BLAKE2B b958561bbc0fefa5982f0aa16dd02cc9
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
 DIST glibc-2.40-patches-3.tar.xz 56044 BLAKE2B 79659397d36fb847cff01589489a90e36286dfe34c0e765fa05259518d8182d7e0f9666a577d699ef0c713071969bb0ec6358c1fbe053ba6cdc8828d08fdaa0b SHA512 5170a2912c7c5f5aa4513abc25402f419a5de56c477597e937b7920f0c652bca1704b4a4f74d12b960ee3bf4eb8985a98712c4dff485609047084caffffb0c95
 DIST glibc-2.40-patches-4.tar.xz 84180 BLAKE2B b64f9d75b8e85e1fa2f0cc685b4d34e9b23e790b57599586263210fa6981bacce31ed657b3921a8aec70fc5cb49676465fd237ed4c55a7116ba04fec4a06d667 SHA512 2efe04a4666540fb885c274f4d1aba4a91510c9dcaf2b9f2ad6316395691eb3458e27a2e4f12d45ea08335de58ef8e3895a3e32a603e6572d8179ffc32a66661
+DIST glibc-2.40-patches-5.tar.xz 87376 BLAKE2B b09b9d2c8e45c0b494223cd01effb14ef205b030f2aeb76e1d7d289997258c1e46d85f8f4ad761e22afc35b1f4747fbca51d7caf252181c7b054b6a3e6bd2bfe SHA512 bf4776c27e5d962d2774afbed2236996a712a6127e5fdccd051af212d86a7e699a932cf4cb22f5516d513b9490b91d5e145727035e845cd4ef290985ac3dc524
 DIST glibc-2.40.tar.xz 18752204 BLAKE2B 8593cab5b2549b77159b6866fbb40b917e491fd5bc0814f7f85b6529166d78d4583436450c479b86cdfe468304fc4d2a9ba8294230a55dbc4c15e89c3ab6c000 SHA512 33caf91dbfddde6480b7cdf7a68b36aff8c522bfee56160af26af297f1b768668edb08bc4e1a7ff61c64721e3c1d49c347a5dd01c5edd3b914ee6479c8b27885
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
 DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc

diff --git a/sys-libs/glibc/glibc-2.40-r5.ebuild b/sys-libs/glibc/glibc-2.40-r5.ebuild
new file mode 100644
index 000000000000..375f9cb25e4e
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.40-r5.ebuild
@@ -0,0 +1,1751 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..13} )
+TMPFILES_OPTIONAL=1
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=5
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+# Minimum systemd version needed (which contains any new syscall changes for
+# its seccomp filter!). Please double check this!
+MIN_SYSTEMD_VER="254.9-r1"
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 )"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+
+	# Fails regularly, unreliable
+	tst-valgrind-smoke
+
+	# https://sourceware.org/bugzilla/show_bug.cgi?id=31877 (bug #927973)
+	tst-shstk-legacy-1g
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
+		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
+		STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' \
+					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
+					| grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+
+		# Allow -O2 and -O3, but nothing else for now.
+		# TODO: Test -Os, -Oz.
+		if ! is-flagq '-O@(2|3)' ; then
+			# Lock glibc at -O2. We want to be conservative here.
+			filter-flags '-O?'
+			append-flags -O2
+		fi
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# Fails to link (bug #940709) in some cases but even if it manages to,
+	# subtle runtime breakage will occur because the linker scripts need
+	# adaptation. Mentioned in PR21557#c0.
+	filter-ldflags '-Wl,--gc-sections'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #798774
+	filter-flags -fno-semantic-interposition
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if ! use cet; then
+		case ${ABI}-${CTARGET} in
+			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
+				append-flags '-fcf-protection=none'
+				;;
+			arm64-aarch64*)
+				append-flags '-mbranch-protection=none'
+				;;
+		esac
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
+
+	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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP=${CPP}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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})"
+		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			ebegin "Checking if the system can execute 32-bit binaries"
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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 supporting IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	case ${ABI}-${CTARGET} in
+		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
+			"${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
+			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-10-09  6:57 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-10-09  6:57 UTC (permalink / raw
  To: gentoo-commits

commit:     bf248662fe6cf52e62f893330c219205885bf2d5
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  9 06:56:16 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Oct  9 06:57:15 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bf248662

sys-libs/glibc: drop 2.40-r3

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest             |    1 -
 sys-libs/glibc/glibc-2.40-r3.ebuild | 1751 -----------------------------------
 2 files changed, 1752 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 03dad97ee95b..75aa8147ee65 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -25,7 +25,6 @@ DIST glibc-2.39-patches-10.tar.xz 193260 BLAKE2B be13f61b1380cda005ef877e6c329b2
 DIST glibc-2.39-patches-6.tar.xz 87600 BLAKE2B 7bb24a16fb64ed07a7477dad075dfedd59ab8d0d4ab3032273684405fd690a863a84fe1f859a07faab3ccd4663ba4f896ca37303cf2a4658ab1662732c50e860 SHA512 d48de19e9e33ef334cdbd63b6ceaddff12424477193f6bb0876105e193f2aba44cb48c33aebc47546db76dc229849cc22f884a68971bbc23994769b64bcd345c
 DIST glibc-2.39-patches-9.tar.xz 110948 BLAKE2B b958561bbc0fefa5982f0aa16dd02cc9cbd015d30d203c02d9ee72605aa51c3e25fac39759487c0deb382a793e3e0274e5585c5a4bd0036bcfaa30fc7dad9021 SHA512 d954a846c4308d4e16d3e878f1ed9ec62f3d78328043289a38cb15148ccf6b431e4a0f185e138300c141ba7e63247922f916ecbab2c8eeaa99d31c54b1ebd0fb
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
-DIST glibc-2.40-patches-3.tar.xz 56044 BLAKE2B 79659397d36fb847cff01589489a90e36286dfe34c0e765fa05259518d8182d7e0f9666a577d699ef0c713071969bb0ec6358c1fbe053ba6cdc8828d08fdaa0b SHA512 5170a2912c7c5f5aa4513abc25402f419a5de56c477597e937b7920f0c652bca1704b4a4f74d12b960ee3bf4eb8985a98712c4dff485609047084caffffb0c95
 DIST glibc-2.40-patches-4.tar.xz 84180 BLAKE2B b64f9d75b8e85e1fa2f0cc685b4d34e9b23e790b57599586263210fa6981bacce31ed657b3921a8aec70fc5cb49676465fd237ed4c55a7116ba04fec4a06d667 SHA512 2efe04a4666540fb885c274f4d1aba4a91510c9dcaf2b9f2ad6316395691eb3458e27a2e4f12d45ea08335de58ef8e3895a3e32a603e6572d8179ffc32a66661
 DIST glibc-2.40-patches-5.tar.xz 87376 BLAKE2B b09b9d2c8e45c0b494223cd01effb14ef205b030f2aeb76e1d7d289997258c1e46d85f8f4ad761e22afc35b1f4747fbca51d7caf252181c7b054b6a3e6bd2bfe SHA512 bf4776c27e5d962d2774afbed2236996a712a6127e5fdccd051af212d86a7e699a932cf4cb22f5516d513b9490b91d5e145727035e845cd4ef290985ac3dc524
 DIST glibc-2.40.tar.xz 18752204 BLAKE2B 8593cab5b2549b77159b6866fbb40b917e491fd5bc0814f7f85b6529166d78d4583436450c479b86cdfe468304fc4d2a9ba8294230a55dbc4c15e89c3ab6c000 SHA512 33caf91dbfddde6480b7cdf7a68b36aff8c522bfee56160af26af297f1b768668edb08bc4e1a7ff61c64721e3c1d49c347a5dd01c5edd3b914ee6479c8b27885

diff --git a/sys-libs/glibc/glibc-2.40-r3.ebuild b/sys-libs/glibc/glibc-2.40-r3.ebuild
deleted file mode 100644
index a33b62687f2e..000000000000
--- a/sys-libs/glibc/glibc-2.40-r3.ebuild
+++ /dev/null
@@ -1,1751 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..12} )
-TMPFILES_OPTIONAL=1
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=3
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-# Minimum systemd version needed (which contains any new syscall changes for
-# its seccomp filter!). Please double check this!
-MIN_SYSTEMD_VER="254.9-r1"
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 )"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# - similarly, valgrind requires knowledge about symbols in ld.so:
-#	bug #920753
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-
-	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
-	tst-sched1
-
-	# Fails regularly, unreliable
-	tst-valgrind-smoke
-
-	# https://sourceware.org/bugzilla/show_bug.cgi?id=31877 (bug #927973)
-	tst-shstk-legacy-1g
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
-		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
-		STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' \
-					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
-					| grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-
-		# Allow -O2 and -O3, but nothing else for now.
-		# TODO: Test -Os, -Oz.
-		if ! is-flagq '-O@(2|3)' ; then
-			# Lock glibc at -O2. We want to be conservative here.
-			filter-flags '-O?'
-			append-flags -O2
-		fi
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# Fails to link (bug #940709) in some cases but even if it manages to,
-	# subtle runtime breakage will occur because the linker scripts need
-	# adaptation. Mentioned in PR21557#c0.
-	filter-ldflags '-Wl,--gc-sections'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #798774
-	filter-flags -fno-semantic-interposition
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if ! use cet; then
-		case ${ABI}-${CTARGET} in
-			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
-				append-flags '-fcf-protection=none'
-				;;
-			arm64-aarch64*)
-				append-flags '-mbranch-protection=none'
-				;;
-		esac
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# glibc does not work with non-bfd (for various reasons):
-	# * gold (bug #269274)
-	# * mold (bug #860900)
-	tc-ld-force-bfd
-
-	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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-	export glibc__ORIG_CPP=${CPP}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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})"
-		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-	export glibc__GLIBC_CPP=${CPP}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking if the system can execute 32-bit binaries"
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			if [[ $STAT -ne 0 ]]; then
-				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
-				eerror "Seek support otherwise."
-				die "Unable to execute 32-bit binaries"
-			fi
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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 supporting IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	case ${ABI}-${CTARGET} in
-		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-		if [[ "$(nice)" == "19" ]] ; then
-			# Expects to be able to increase niceness, which it can't do if
-			# already at the highest nice value
-			XFAIL_TEST_LIST+=( "tst-nice" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	# valgrind requires knowledge about ld.so symbols.
-	dostrip -x $(alt_libdir)/ld-*.so*
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
-			"${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
-			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-10-09  9:16 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-10-09  9:16 UTC (permalink / raw
  To: gentoo-commits

commit:     656f24cf4af5c687e7863cc9fc8a18a9c05a4124
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  9 09:14:48 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Oct  9 09:16:05 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=656f24cf

sys-libs/glibc: keyword 2.40-r5 (patchlevel 5)

Patchset changelog 2.40-4..2.40-5
6d6b908b56 (HEAD -> gentoo/2.40, tag: gentoo/glibc-2.40-5, gentoo/gentoo/2.40) libio: Set _vtable_offset before calling _IO_link_in [BZ #32148]
7bb87201e6 Disable _TIME_BITS if the compiler defaults to it
838ba39617 Disable _FILE_OFFSET_BITS if the compiler defaults to it

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.40-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.40-r5.ebuild b/sys-libs/glibc/glibc-2.40-r5.ebuild
index 375f9cb25e4e..5ad8b411f5b0 100644
--- a/sys-libs/glibc/glibc-2.40-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.40-r5.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-10-10  1:13 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-10-10  1:13 UTC (permalink / raw
  To: gentoo-commits

commit:     eb1f5c19bc26b4ab275ca7caefca75edd23ede0b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 10 01:12:42 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Oct 10 01:13:25 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eb1f5c19

sys-libs/glibc: add 2.39-r11 (patchlevel 11)

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    1 +
 sys-libs/glibc/glibc-2.39-r11.ebuild | 1751 ++++++++++++++++++++++++++++++++++
 2 files changed, 1752 insertions(+)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index 75aa8147ee65..b336d7dbbc6b 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -22,6 +22,7 @@ DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb8
 DIST glibc-2.38-patches-13.tar.xz 92708 BLAKE2B b2f05a793c92ea0b7901d2124fcd968fa846fdf687f8cbdbc17795c33fae2d538133fae66d575c5b98a7a05a29f9f816e7ecd45f3be5ed10ef65adbf92c7fc4d SHA512 24e45a88fa7676ef22a7e2bb864dff27262f69900c4ef76d21c6fee498d728949b6f5d03dd094d1774a66a8a47b779bf4b16ee31e5306bcdb55cedcc0a1c5e9f
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
 DIST glibc-2.39-patches-10.tar.xz 193260 BLAKE2B be13f61b1380cda005ef877e6c329b2d042e756b85b4711c502495074d28af35a2a4998641e2a317888105d260e0ec5c6a7f2cbdd1e68fd9ff95f88d680616d6 SHA512 8df0f9181c9129fda4e84d46ccd0bd0c6f8ecec93c0c702830b02241d001f973351187a1299dc905685907ffda6b3605043ccfd1c08fd92d7e5c358070a760d0
+DIST glibc-2.39-patches-11.tar.xz 192784 BLAKE2B fef42e0bd2a3341f41cac56dc878dcc95b7f521ffb27686a9109fe92e0458e903a24e763db17631b8ae6c1e8de7add2a11979b970689b2378aeb6ef29da7ceb6 SHA512 9daf2c57d178c7ce9d98ee454f680280738b37571bbbecc1724282e4866df29b78e60de40ad81a6efcc0a75b45d08148cb1a5f942ae7e308ae6fa63f9671b7de
 DIST glibc-2.39-patches-6.tar.xz 87600 BLAKE2B 7bb24a16fb64ed07a7477dad075dfedd59ab8d0d4ab3032273684405fd690a863a84fe1f859a07faab3ccd4663ba4f896ca37303cf2a4658ab1662732c50e860 SHA512 d48de19e9e33ef334cdbd63b6ceaddff12424477193f6bb0876105e193f2aba44cb48c33aebc47546db76dc229849cc22f884a68971bbc23994769b64bcd345c
 DIST glibc-2.39-patches-9.tar.xz 110948 BLAKE2B b958561bbc0fefa5982f0aa16dd02cc9cbd015d30d203c02d9ee72605aa51c3e25fac39759487c0deb382a793e3e0274e5585c5a4bd0036bcfaa30fc7dad9021 SHA512 d954a846c4308d4e16d3e878f1ed9ec62f3d78328043289a38cb15148ccf6b431e4a0f185e138300c141ba7e63247922f916ecbab2c8eeaa99d31c54b1ebd0fb
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2

diff --git a/sys-libs/glibc/glibc-2.39-r11.ebuild b/sys-libs/glibc/glibc-2.39-r11.ebuild
new file mode 100644
index 000000000000..922b3f794c97
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.39-r11.ebuild
@@ -0,0 +1,1751 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
+# Please read & adapt the page as necessary if obsolete.
+
+PYTHON_COMPAT=( python3_{10..12} )
+TMPFILES_OPTIONAL=1
+
+EMULTILIB_PKG="true"
+
+# Gentoo patchset (ignored for live ebuilds)
+PATCH_VER=11
+PATCH_DEV=dilfridge
+
+# gcc mulitilib bootstrap files version
+GCC_BOOTSTRAP_VER=20201208
+
+# systemd integration version
+GLIBC_SYSTEMD_VER=20210729
+
+# 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"
+
+# Minimum systemd version needed (which contains any new syscall changes for
+# its seccomp filter!). Please double check this!
+MIN_SYSTEMD_VER="254.9-r1"
+
+inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
+	multilib systemd multiprocessing tmpfiles
+
+DESCRIPTION="GNU libc C library"
+HOMEPAGE="https://www.gnu.org/software/libc/"
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+else
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
+	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
+fi
+
+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 )"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+SLOT="2.2"
+IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
+
+# Here's how the cross-compile logic breaks down ...
+#  CTARGET - machine that will target the binaries
+#  CHOST   - machine that will host the binaries
+#  CBUILD  - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+#  CBUILD = CHOST = CTARGET    - native build/install
+#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
+#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
+# For install paths:
+#  CHOST = CTARGET  - install into /
+#  CHOST != CTARGET - install into /usr/CTARGET/
+#
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+# Note [Disable automatic stripping]
+# Disabling automatic stripping for a few reasons:
+# - portage's attempt to strip breaks non-native binaries at least on
+#   arm: bug #697428
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread
+#   enumeration: bug #697910. This is quite subtle:
+#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
+#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
+#     via 'ps_pglobal_lookup' symbol defined in gdb.
+#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
+#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
+#     (unexported) is used to sanity check compatibility before enabling
+#     debugging.
+#     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
+#   * normal 'strip' command trims '.symtab'
+#   Thus our main goal here is to prevent 'libpthread.so.0' from
+#   losing it's '.symtab' entries.
+# - similarly, valgrind requires knowledge about symbols in ld.so:
+#	bug #920753
+# As Gentoo's strip does not allow us to pass less aggressive stripping
+# options and does not check the machine target we strip selectively.
+
+# We need a new-enough binutils/gcc to match upstream baseline.
+# Also we need to make sure our binutils/gcc supports TLS,
+# and that gcc already contains the hardened patches.
+# Lastly, let's avoid some openssh nastiness, bug 708224, as
+# convenience to our users.
+
+IDEPEND="
+	!compile-locales? ( sys-apps/locale-gen )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	sys-devel/bison
+	compile-locales? ( sys-apps/locale-gen )
+	doc? (
+		dev-lang/perl
+		sys-apps/texinfo
+	)
+	test? (
+		dev-lang/perl
+		>=net-dns/libidn2-2.3.0
+	)
+"
+COMMON_DEPEND="
+	gd? ( media-libs/gd:2= )
+	nscd? ( selinux? (
+		audit? ( sys-process/audit )
+		caps? ( sys-libs/libcap )
+	) )
+	suid? ( caps? ( sys-libs/libcap ) )
+	selinux? ( sys-libs/libselinux )
+	systemtap? ( dev-debug/systemtap )
+"
+DEPEND="${COMMON_DEPEND}
+"
+RDEPEND="${COMMON_DEPEND}
+	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
+	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
+	perl? ( dev-lang/perl )
+"
+
+RESTRICT="!test? ( test )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+	BDEPEND+=" !headers-only? (
+		>=${CATEGORY}/binutils-2.27
+		>=${CATEGORY}/gcc-6.2
+	)"
+	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+	BDEPEND+="
+		>=sys-devel/binutils-2.27
+		>=sys-devel/gcc-6.2
+	"
+	DEPEND+=" virtual/os-headers "
+	RDEPEND+="
+		>=net-dns/libidn2-2.3.0
+		vanilla? ( !sys-libs/timezone-data )
+	"
+	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+# Ignore tests whitelisted below
+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=(
+	# 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
+
+	# The following tests fail only inside portage
+	# https://bugs.gentoo.org/831267
+	tst-system
+	tst-strerror
+	tst-strsignal
+
+	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
+	tst-sched1
+
+	# Fails regularly, unreliable
+	tst-valgrind-smoke
+
+	# https://sourceware.org/bugzilla/show_bug.cgi?id=31877 (bug #927973)
+	tst-shstk-legacy-1g
+)
+
+XFAIL_NSPAWN_TEST_LIST=(
+	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
+	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
+	# https://sourceware.org/PR30603
+	test-errno-linux
+	tst-bz21269
+	tst-mlock2
+	tst-ntp_gettime
+	tst-ntp_gettime-time64
+	tst-ntp_gettimex
+	tst-ntp_gettimex-time64
+	tst-pkey
+	tst-process_mrelease
+	tst-adjtime
+	tst-adjtime-time64
+	tst-clock2
+	tst-clock2-time64
+
+	# These fail if --suppress-sync and/or low priority is set
+	tst-sync_file_range
+	test-errno
+)
+
+#
+# Small helper functions
+#
+
+dump_build_environment() {
+	einfo ==== glibc build environment ========================================================
+	local v
+	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
+		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
+		STRINGS OBJDUMP READELF; do
+		einfo " $(printf '%15s' ${v}:)   ${!v}"
+	done
+	einfo =====================================================================================
+}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	is_crosscompile && use headers-only
+}
+
+alt_prefix() {
+	is_crosscompile && echo /usr/${CTARGET}
+}
+
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+	is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+	is_crosscompile && echo "${EPREFIX}"
+}
+
+# We need to be able to set alternative headers for compiling for non-native
+# platform. Will also become useful for testing kernel-headers without screwing
+# up the whole system.
+alt_headers() {
+	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+
+alt_build_headers() {
+	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
+		if tc-is-cross-compiler ; then
+			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+				local header_path=$(echo '#include <linux/version.h>' \
+					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
+					| grep -o '[^"]*linux/version.h')
+				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+			fi
+		fi
+	fi
+	echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+	echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+	echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+do_compile_test() {
+	local ret save_cflags=${CFLAGS}
+	CFLAGS+=" $1"
+	shift
+
+	pushd "${T}" >/dev/null
+
+	rm -f glibc-test*
+	printf '%b' "$*" > glibc-test.c
+
+	# We assume CC is already set up.
+	nonfatal emake glibc-test
+	ret=$?
+
+	popd >/dev/null
+
+	CFLAGS=${save_cflags}
+	return ${ret}
+}
+
+do_run_test() {
+	local ret
+
+	if [[ ${MERGE_TYPE} == "binary" ]] ; then
+		# ignore build failures when installing a binary package #324685
+		do_compile_test "" "$@" 2>/dev/null || return 0
+	else
+		if ! do_compile_test "" "$@" ; then
+			ewarn "Simple build failed ... assuming this is desired #324685"
+			return 0
+		fi
+	fi
+
+	pushd "${T}" >/dev/null
+
+	./glibc-test
+	ret=$?
+	rm -f glibc-test*
+
+	popd >/dev/null
+
+	return ${ret}
+}
+
+setup_target_flags() {
+	# This largely mucks with compiler flags.  None of which should matter
+	# when building up just the headers.
+	just_headers && return 0
+
+	case $(tc-arch) in
+		x86)
+			# -march needed for #185404 #199334
+			# TODO: When creating the first glibc cross-compile, this test will
+			# always fail as it does a full link which in turn requires glibc.
+			# Probably also applies when changing multilib profile settings (e.g.
+			# enabling x86 when the profile was amd64-only previously).
+			# We could change main to _start and pass -nostdlib here so that we
+			# only test the gcc code compilation.  Or we could do a compile and
+			# then look for the symbol via scanelf.
+			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
+				local t=${CTARGET_OPT:-${CTARGET}}
+				t=${t%%-*}
+				filter-flags '-march=*'
+				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.
+			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"
+			fi
+		;;
+		mips)
+			# The mips abi cannot support the GNU style hashes. #233233
+			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+		;;
+		ppc|ppc64)
+			# Many arch-specific implementations do not work on ppc with
+			# cache-block not equal to 128 bytes. This breaks memset:
+			#   https://sourceware.org/PR26522
+			#   https://bugs.gentoo.org/737996
+			# Use default -mcpu=. For ppc it means non-multiarch setup.
+			filter-flags '-mcpu=*'
+		;;
+		sparc)
+			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
+			filter-flags "-fcall-used-g7"
+			append-flags "-fcall-used-g6"
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				cpu="sparc64"
+				case $(get-flag mcpu) in
+				v9)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					append-flags "-Wa,-xarch=v9a"
+					;;
+				esac
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				*)
+					cpu="sparcv9"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
+		;;
+	esac
+}
+
+setup_flags() {
+	# Make sure host make.conf doesn't pollute us
+	if is_crosscompile || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+
+	# Store our CFLAGS because it's changed depending on which CTARGET
+	# we are building when pulling glibc on a multilib profile
+	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+	CFLAGS=${CFLAGS_BASE}
+	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+	CXXFLAGS=${CXXFLAGS_BASE}
+	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+	ASFLAGS=${ASFLAGS_BASE}
+
+	# Allow users to explicitly avoid flag sanitization via
+	# USE=custom-cflags.
+	if ! use custom-cflags; then
+		# Over-zealous CFLAGS can often cause problems.  What may work for one
+		# person may not work for another.  To avoid a large influx of bugs
+		# relating to failed builds, we strip most CFLAGS out to ensure as few
+		# problems as possible.
+		strip-flags
+
+		# Allow -O2 and -O3, but nothing else for now.
+		# TODO: Test -Os, -Oz.
+		if ! is-flagq '-O@(2|3)' ; then
+			# Lock glibc at -O2. We want to be conservative here.
+			filter-flags '-O?'
+			append-flags -O2
+		fi
+	fi
+
+	strip-unsupported-flags
+	filter-lto
+	filter-flags -m32 -m64 '-mabi=*'
+
+	# glibc aborts if rpath is set by LDFLAGS
+	filter-ldflags '-Wl,-rpath=*'
+
+	# ld can't use -r & --relax at the same time, bug #788901
+	# https://sourceware.org/PR27837
+	filter-ldflags '-Wl,--relax'
+
+	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
+	# anyway because glibc already handles this by itself.
+	filter-ldflags '-Wl,--dynamic-linker=*'
+
+	# Fails to link (bug #940709) in some cases but even if it manages to,
+	# subtle runtime breakage will occur because the linker scripts need
+	# adaptation. Mentioned in PR21557#c0.
+	filter-ldflags '-Wl,--gc-sections'
+
+	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
+	# we have to do that here already so mips can filter it out again :P
+	if use hash-sysv-compat ; then
+		append-ldflags '-Wl,--hash-style=both'
+	fi
+
+	# #492892
+	filter-flags -frecord-gcc-switches
+
+	# #898098
+	filter-flags -fno-builtin
+
+	# #798774
+	filter-flags -fno-semantic-interposition
+
+	# #829583
+	filter-lfs-flags
+
+	unset CBUILD_OPT CTARGET_OPT
+	if use multilib ; then
+		CTARGET_OPT=$(get_abi_CTARGET)
+		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+	fi
+
+	setup_target_flags
+
+	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+		CBUILD_OPT=${CTARGET_OPT}
+	fi
+
+	# glibc's headers disallow -O0 and fail at build time:
+	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
+	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
+	replace-flags -O0 -O1
+
+	# glibc handles this internally already where it's appropriate;
+	# can't always have SSP when we're the ones setting it up, etc
+	filter-flags '-fstack-protector*'
+
+	# Similar issues as with SSP. Can't inject yourself that early.
+	filter-flags '-fsanitize=*'
+
+	# See end of bug #830454; we handle this via USE=cet
+	filter-flags '-fcf-protection=*'
+
+	# When bootstrapping, we may have a situation where
+	# CET-enabled gcc from seed is used to build CET-disabled
+	# glibc. As such, gcc implicitly enables CET if no
+	# -fcf-protection flag is passed. For a typical package it
+	# should not be a problem, but for glibc it matters as it is
+	# dealing with CET in ld.so. So if CET is supposed to be
+	# disabled for glibc, be explicit about it.
+	if ! use cet; then
+		case ${ABI}-${CTARGET} in
+			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
+				append-flags '-fcf-protection=none'
+				;;
+			arm64-aarch64*)
+				append-flags '-mbranch-protection=none'
+				;;
+		esac
+	fi
+}
+
+use_multiarch() {
+	# Allow user to disable runtime arch detection in multilib.
+	use multiarch || return 1
+	# Make sure binutils is new enough to support indirect functions,
+	# #336792. This funky sed supports gold and bfd linkers.
+	local bver nver
+	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+	case $(tc-arch ${CTARGET}) in
+	amd64|x86) nver="2.20" ;;
+	arm)       nver="2.22" ;;
+	hppa)      nver="2.23" ;;
+	ppc|ppc64) nver="2.20" ;;
+	# ifunc support was added in 2.23, but glibc also needs
+	# machinemode which is in 2.24.
+	s390)      nver="2.24" ;;
+	sparc)     nver="2.21" ;;
+	*)         return 1 ;;
+	esac
+	ver_test ${bver} -ge ${nver}
+}
+
+# Setup toolchain variables that had historically been defined in the
+# profiles for these archs.
+setup_env() {
+	# silly users
+	unset LD_RUN_PATH
+	unset LD_ASSUME_KERNEL
+
+	if is_crosscompile || tc-is-cross-compiler ; then
+		multilib_env ${CTARGET_OPT:-${CTARGET}}
+
+		if ! use multilib ; then
+			MULTILIB_ABIS=${DEFAULT_ABI}
+		else
+			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+		fi
+
+		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+		# and fall back on CFLAGS.
+		local VAR=CFLAGS_${CTARGET//[-.]/_}
+		CFLAGS=${!VAR-${CFLAGS}}
+		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
+	fi
+
+	setup_flags
+
+	export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+	if just_headers ; then
+		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
+		# At this bootstrap stage we have only binutils for
+		# target but not compiler yet.
+		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
+		return 0
+	fi
+
+	# glibc does not work with non-bfd (for various reasons):
+	# * gold (bug #269274)
+	# * mold (bug #860900)
+	tc-ld-force-bfd
+
+	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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
+	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
+	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
+
+	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
+	export glibc__ORIG_CC=${CC}
+	export glibc__ORIG_CXX=${CXX}
+	export glibc__ORIG_CPP=${CPP}
+
+	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
+		export glibc__force_gcc=yes
+		# once this is toggled on, it needs to stay on, since with CPP manipulated
+		# tc-is-clang does not work correctly anymore...
+	fi
+
+	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
+		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})"
+		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
+	# acts on CC?)
+	export glibc__GLIBC_CC=${CC}
+	export glibc__GLIBC_CXX=${CXX}
+	export glibc__GLIBC_CPP=${CPP}
+
+	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
+
+	if is_crosscompile; then
+		# Assume worst-case bootstrap: glibc is built for the first time
+		# with ${CTARGET}-g++ 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() {
+	setup_env
+
+	local ret=0
+	local abilist=""
+	if use multilib ; then
+		abilist=$(get_install_abis)
+	else
+		abilist=${DEFAULT_ABI}
+	fi
+	local -x ABI
+	for ABI in ${abilist:-default} ; do
+		setup_env
+		einfo "Running $1 for ABI ${ABI}"
+		$1
+		: $(( ret |= $? ))
+	done
+	return ${ret}
+}
+
+glibc_banner() {
+	local b="Gentoo ${PVR}"
+	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
+	echo "${b}"
+}
+
+# The following Kernel version handling functions are mostly copied from portage
+# source. It's better not to use linux-info.eclass here since a) it adds too
+# much magic, see bug 326693 for some of the arguments, and b) some of the
+# functions are just not provided.
+
+g_get_running_KV() {
+	uname -r
+	return $?
+}
+
+g_KV_major() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+g_KV_minor() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+g_KV_micro() {
+	[[ -z $1 ]] && return 1
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+g_KV_to_int() {
+	[[ -z $1 ]] && return 1
+	local KV_MAJOR=$(g_KV_major "$1")
+	local KV_MINOR=$(g_KV_minor "$1")
+	local KV_MICRO=$(g_KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+	return 1
+}
+
+g_int_to_KV() {
+	local version=$1 major minor micro
+	major=$((version / 65536))
+	minor=$(((version % 65536) / 256))
+	micro=$((version % 256))
+	echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
+	eend $?
+}
+
+get_kheader_version() {
+	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
+	tail -n 1
+}
+
+# We collect all sanity checks here. Consistency is not guranteed between
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
+# src_unpack.
+sanity_prechecks() {
+	# Prevent native builds from downgrading
+	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+	   [[ -z ${ROOT} ]] && \
+	   [[ ${CBUILD} == ${CHOST} ]] && \
+	   [[ ${CHOST} == ${CTARGET} ]] ; then
+
+		# The high rev # is to allow people to downgrade between -r#
+		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
+		# should be fine. Hopefully we never actually use a r# this
+		# high.
+		if has_version ">${CATEGORY}/${P}-r10000" ; then
+			eerror "Sanity check to keep you from breaking your system:"
+			eerror " Downgrading glibc is not supported and a sure way to destruction."
+			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
+		fi
+
+		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
+			eerror "Your old kernel is broken. You need to update it to a newer"
+			eerror "version as syscall(<bignum>) will break. See bug 279260."
+			die "Old and broken kernel."
+		fi
+	fi
+
+	if [[ ${CTARGET} == i386-* ]] ; then
+		eerror "i386 CHOSTs are no longer supported."
+		eerror "Chances are you don't actually want/need i386."
+		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
+		die "Please fix your CHOST"
+	fi
+
+	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+		ewarn "This will result in a 50% performance penalty when running with a 32bit"
+		ewarn "hypervisor, which is probably not what you want."
+	fi
+
+	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
+	# we test for...
+	if ! is_crosscompile ; then
+		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
+			ebegin "Checking if the system can execute 32-bit binaries"
+			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
+				"${T}/check-ia32-emulation.elf32"
+				STAT=$?
+			else
+				# Don't fail here to allow single->multi ABI switch
+				# or recover from breakage like bug #646424
+				ewarn "Failed to compile the ABI test. Broken host glibc?"
+				STAT=0
+			fi
+			rm -f "${T}/check-ia32-emulation.elf32"
+			eend $STAT
+			if [[ $STAT -ne 0 ]]; then
+				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
+				eerror "Seek support otherwise."
+				die "Unable to execute 32-bit binaries"
+			fi
+		fi
+
+	fi
+
+	# When we actually have to compile something...
+	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
+			local run_kv build_kv want_kv
+
+			run_kv=$(g_get_running_KV)
+			build_kv=$(g_int_to_KV $(get_kheader_version))
+			want_kv=${MIN_KERN_VER}
+
+			if ! is_crosscompile && ! tc-is-cross-compiler ; then
+				# Building fails on an non-supporting kernel
+				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
+				if ! eend_KV ${run_kv} ${want_kv} ; then
+					echo
+					eerror "You need a kernel of at least ${want_kv}!"
+					die "Kernel version too low!"
+				fi
+			fi
+
+			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
+			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
+			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
+			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
+			# need to run this check at all given we have a dependency on the right headers,
+			# but let's leave it as-is for now.
+			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
+				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+				if ! eend_KV ${build_kv} ${want_kv} ; then
+					echo
+					eerror "You need linux-headers of at least ${want_kv}!"
+					die "linux-headers version too low!"
+				fi
+			fi
+		fi
+	fi
+}
+
+upgrade_warning() {
+	is_crosscompile && return
+
+	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
+#
+
+# pkg_pretend
+
+pkg_pretend() {
+	upgrade_warning
+}
+
+# pkg_setup
+
+pkg_setup() {
+	# see bug 682570
+	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
+}
+
+# src_unpack
+
+src_unpack() {
+	setup_env
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
+
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patches || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
+	fi
+
+	cd "${WORKDIR}" || die
+	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
+}
+
+# src_prepare
+
+src_prepare() {
+	local patchsetname
+	if ! use vanilla ; then
+		if [[ ${PV} == 9999* ]] ; then
+			patchsetname="from git master"
+		else
+			patchsetname="${PV}-${PATCH_VER}"
+		fi
+		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
+		eapply "${WORKDIR}"/patches
+		einfo "Done."
+	fi
+
+	default
+
+	gnuconfig_update
+
+	cd "${WORKDIR}" || die
+	find . -name configure -exec touch {} +
+
+	# Fix permissions on some of the scripts.
+	chmod u+x "${S}"/scripts/*.sh
+
+	cd "${S}" || die
+}
+
+# src_configure
+
+glibc_do_configure() {
+	dump_build_environment
+
+	local myconf=()
+
+	# 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 supporting IFUNC. glibc's ./configure
+	# is not robust enough to detect proper support:
+	#    https://bugs.gentoo.org/641216
+	#    https://sourceware.org/PR22634#c0
+	case $(tc-arch ${CTARGET}) in
+		# Keep whitelist of targets where autodetection mostly works.
+		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
+		# Blacklist everywhere else
+		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+	esac
+
+	case ${ABI}-${CTARGET} in
+		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
+		*) ;;
+	esac
+
+	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+	myconf+=( --enable-kernel=${MIN_KERN_VER} )
+
+	# Since SELinux support is only required for nscd, only enable it if:
+	# 1. USE selinux
+	# 2. only for the primary ABI on multilib systems
+	# 3. Not a crosscompile
+	if ! is_crosscompile && use selinux ; then
+		if use multilib ; then
+			if is_final_abi ; then
+				myconf+=( --with-selinux )
+			else
+				myconf+=( --without-selinux )
+			fi
+		else
+			myconf+=( --with-selinux )
+		fi
+	else
+		myconf+=( --without-selinux )
+	fi
+
+	# Force a few tests where we always know the answer but
+	# configure is incapable of finding it.
+	if is_crosscompile ; then
+		export \
+			libc_cv_c_cleanup=yes \
+			libc_cv_forced_unwind=yes
+	fi
+
+	myconf+=(
+		--disable-werror
+		--enable-bind-now
+		--enable-fortify-source
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		$(use_enable profile)
+		$(use_with gd)
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		--sysconfdir="$(host_eprefix)/etc"
+		--localstatedir="$(host_eprefix)/var"
+		--libdir='$(prefix)'/$(get_libdir)
+		--mandir='$(prefix)'/share/man
+		--infodir='$(prefix)'/share/info
+		--libexecdir='$(libdir)'/misc/glibc
+		--with-bugurl=https://bugs.gentoo.org/
+		--with-pkgversion="$(glibc_banner)"
+		$(use_multiarch || echo --disable-multi-arch)
+		$(use_enable systemtap)
+		$(use_enable nscd)
+
+		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
+		# Perl hasn't been installed inside the prefix yet and configure picks
+		# up a Perl from outside the prefix instead. configure will fail to
+		# execute Perl during configure if we're cross-compiling a prefix, but
+		# it will just disable mtrace in that case.
+		# Note: mtrace is needed by the test suite.
+		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
+
+		# locale data is arch-independent
+		# https://bugs.gentoo.org/753740
+		libc_cv_complocaledir='${exec_prefix}/lib/locale'
+
+		# On aarch64 there is no way to override -mcpu=native, and if
+		# the current cpu does not support SVE configure fails.
+		# Let's boldly assume our toolchain can always build SVE instructions.
+		libc_cv_aarch64_sve_asm=yes
+
+		${EXTRA_ECONF}
+	)
+
+	# We rely on sys-libs/timezone-data for timezone tools normally.
+	myconf+=( $(use_enable vanilla timezone-tools) )
+
+	# These libs don't have configure flags.
+	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
+	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
+
+	# There is no configure option for this and we need to export it
+	# since the glibc build will re-run configure on itself
+	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
+
+	local builddir=$(builddir nptl)
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+	set -- "${S}"/configure "${myconf[@]}"
+	echo "$@"
+	"$@" || die "failed to configure glibc"
+
+	# If we're trying to migrate between ABI sets, we need
+	# to lie and use a local copy of gcc.  Like if the system
+	# is built with MULTILIB_ABIS="amd64 x86" but we want to
+	# add x32 to it, gcc/glibc don't yet support x32.
+	#
+	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
+		echo 'int main(void){}' > "${T}"/test.c || die
+		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+		fi
+	fi
+}
+
+glibc_headers_configure() {
+	export ABI=default
+
+	local builddir=$(builddir "headers")
+	mkdir -p "${builddir}"
+	cd "${builddir}"
+
+	# if we don't have a compiler yet, we can't really test it now ...
+	# hopefully they don't affect header generation, so let's hope for
+	# the best here ...
+	local v vars=(
+		ac_cv_header_cpuid_h=yes
+		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+		libc_cv_asm_cfi_directives=yes
+		libc_cv_broken_visibility_attribute=no
+		libc_cv_c_cleanup=yes
+		libc_cv_compiler_powerpc64le_binary128_ok=yes
+		libc_cv_forced_unwind=yes
+		libc_cv_gcc___thread=yes
+		libc_cv_mlong_double_128=yes
+		libc_cv_mlong_double_128ibm=yes
+		libc_cv_ppc_machine=yes
+		libc_cv_ppc_rel16=yes
+		libc_cv_predef_fortify_source=no
+		libc_cv_target_power8_ok=yes
+		libc_cv_visibility_attribute=yes
+		libc_cv_z_combreloc=yes
+		libc_cv_z_execstack=yes
+		libc_cv_z_initfirst=yes
+		libc_cv_z_nodelete=yes
+		libc_cv_z_nodlopen=yes
+		libc_cv_z_relro=yes
+		libc_mips_abi=${ABI}
+		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+		# These libs don't have configure flags.
+		ac_cv_lib_audit_audit_log_user_avc_message=no
+		ac_cv_lib_cap_cap_init=no
+	)
+
+	einfo "Forcing cached settings:"
+	for v in "${vars[@]}" ; do
+		einfo " ${v}"
+		export ${v}
+	done
+
+	local headers_only_arch_CPPFLAGS=()
+
+	# Blow away some random CC settings that screw things up. #550192
+	if [[ -d ${S}/sysdeps/mips ]]; then
+		pushd "${S}"/sysdeps/mips >/dev/null
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+
+		# Force the mips ABI to the default.  This is OK because the set of
+		# installed headers in this phase is the same between the 3 ABIs.
+		# If this ever changes, this hack will break, but that's unlikely
+		# as glibc discourages that behavior.
+		# https://crbug.com/647033
+		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
+
+		popd >/dev/null
+	fi
+
+	local myconf=()
+
+	case ${CTARGET} in
+	aarch64*)
+		# The configure checks fail during cross-build, so disable here
+		# for headers-only
+		myconf+=(
+			--disable-mathvec
+		) ;;
+	riscv*)
+		# RISC-V interrogates the compiler to determine which target to
+		# build.  If building the headers then we don't strictly need a
+		# RISC-V compiler, so the built-in definitions that are provided
+		# along with all RISC-V compiler might not exist.  This causes
+		# glibc's RISC-V preconfigure script to blow up.  Since we're just
+		# building the headers any value will actually work here, so just
+		# pick the standard one (rv64g/lp64d) to make the build scripts
+		# happy for now -- the headers are all the same anyway so it
+		# doesn't matter.
+		headers_only_arch_CPPFLAGS+=(
+			-D__riscv_xlen=64
+			-D__riscv_flen=64
+			-D__riscv_float_abi_double=1
+			-D__riscv_atomic=1
+		) ;;
+	esac
+
+	myconf+=(
+		--disable-sanity-checks
+		--enable-hacker-mode
+		--disable-werror
+		--enable-bind-now
+		--build=${CBUILD_OPT:-${CBUILD}}
+		--host=${CTARGET_OPT:-${CTARGET}}
+		--with-headers=$(build_eprefix)$(alt_build_headers)
+		--prefix="$(host_eprefix)/usr"
+		${EXTRA_ECONF}
+	)
+
+	# Nothing is compiled here which would affect the headers for the target.
+	# So forcing CC/CFLAGS is sane.
+	local headers_only_CC=$(tc-getBUILD_CC)
+	local headers_only_CFLAGS="-O1 -pipe"
+	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
+	local headers_only_LDFLAGS=""
+	set -- "${S}"/configure "${myconf[@]}"
+	echo \
+		"CC=${headers_only_CC}" \
+		"CFLAGS=${headers_only_CFLAGS}" \
+		"CPPFLAGS=${headers_only_CPPFLAGS}" \
+		"LDFLAGS=${headers_only_LDFLAGS}" \
+		"$@"
+	CC=${headers_only_CC} \
+	CFLAGS=${headers_only_CFLAGS} \
+	CPPFLAGS=${headers_only_CPPFLAGS} \
+	LDFLAGS="" \
+	"$@" || die "failed to configure glibc"
+}
+
+do_src_configure() {
+	if just_headers ; then
+		glibc_headers_configure
+	else
+		glibc_do_configure nptl
+	fi
+}
+
+src_configure() {
+	foreach_abi do_src_configure
+}
+
+# src_compile
+
+do_src_compile() {
+	emake -C "$(builddir nptl)"
+}
+
+src_compile() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi do_src_compile
+}
+
+# src_test
+
+glibc_src_test() {
+	cd "$(builddir nptl)"
+
+	local myxfailparams=""
+	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
+		local virt=$(systemd-detect-virt 2>/dev/null)
+		if [[ ${virt} == systemd-nspawn ]] ; then
+			ewarn "Skipping extra tests because in systemd-nspawn container"
+			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
+		fi
+		if [[ "$(nice)" == "19" ]] ; then
+			# Expects to be able to increase niceness, which it can't do if
+			# already at the highest nice value
+			XFAIL_TEST_LIST+=( "tst-nice" )
+		fi
+
+		for myt in ${XFAIL_TEST_LIST[@]} ; do
+			myxfailparams+="test-xfail-${myt}=yes "
+		done
+	fi
+
+	# sandbox does not understand unshare() and prevents
+	# writes to /proc/, which makes many tests fail
+
+	# 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
+}
+
+src_test() {
+	if just_headers ; then
+		return
+	fi
+
+	foreach_abi glibc_src_test || die "tests failed"
+}
+
+# src_install
+
+run_locale_gen() {
+	# if the host locales.gen contains no entries, we'll install everything
+	local root="$1"
+	local inplace=""
+
+	if [[ "${root}" == "--inplace-glibc" ]] ; then
+		inplace="--inplace-glibc"
+		root="$2"
+	fi
+
+	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"
+	fi
+
+	# bug 736794: we need to be careful with the parallelization... the number of
+	# processors saved in the environment of a binary package may differ strongly
+	# from the number of processes available during postinst
+	local mygenjobs="$(makeopts_jobs)"
+	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
+		mygenjobs="$(nproc)"
+	fi
+
+	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
+		--destdir "${root}"
+	echo "$@"
+	"$@"
+
+	popd >/dev/null
+}
+
+glibc_do_src_install() {
+	local builddir=$(builddir nptl)
+	cd "${builddir}"
+
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+
+	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
+	# which come without headers etc. Only needed for binary packages since the
+	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
+	find "${D}" -name "libnsl.a" -delete
+	find "${D}" -name "libnsl.so" -delete
+
+	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
+	# to infer upstream version:
+	# '#define VERSION "2.26.90"' -> '2.26.90'
+	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
+
+	# Avoid stripping binaries not targeted by ${CHOST}. Or else
+	# ${CHOST}-strip would break binaries build for ${CTARGET}.
+	is_crosscompile && dostrip -x /
+
+	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
+	# See Note [Disable automatic stripping]
+	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+	# valgrind requires knowledge about ld.so symbols.
+	dostrip -x $(alt_libdir)/ld-*.so*
+
+	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+		# Move versioned .a file out of libdir to evade portage QA checks
+		# instead of using gen_usr_ldscript(). We fix ldscript as:
+		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
+		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
+			"${ED}"/$(alt_usrlibdir)/libm.a || die
+		dodir $(alt_usrlibdir)/${P}
+		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
+			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+	fi
+
+	# We configure toolchains for standalone prefix systems with a sysroot,
+	# which is prepended to paths in ld scripts, so strip the prefix from these.
+	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
+	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
+	if [[ -n $(host_eprefix) ]] ; then
+		local file
+		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
+			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
+		done
+	fi
+
+	# We'll take care of the cache ourselves
+	rm -f "${ED}"/etc/ld.so.cache
+
+	# Everything past this point just needs to be done once ...
+	is_final_abi || return 0
+
+	# Make sure the non-native interp can be found on multilib systems even
+	# if the main library set isn't installed into the right place.  Maybe
+	# we should query the active gcc for info instead of hardcoding it ?
+	local i ldso_abi ldso_name
+	local ldso_abi_list=(
+		# x86
+		amd64   /lib64/ld-linux-x86-64.so.2
+		x32     /libx32/ld-linux-x32.so.2
+		x86     /lib/ld-linux.so.2
+		# mips
+		o32     /lib/ld.so.1
+		n32     /lib32/ld.so.1
+		n64     /lib64/ld.so.1
+		# powerpc
+		ppc     /lib/ld.so.1
+		# riscv
+		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
+		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
+		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
+		lp64    /lib/ld-linux-riscv64-lp64.so.1
+		# s390
+		s390    /lib/ld.so.1
+		s390x   /lib/ld64.so.1
+		# sparc
+		sparc32 /lib/ld-linux.so.2
+		sparc64 /lib64/ld-linux.so.2
+	)
+	case $(tc-endian) in
+	little)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64.so.1
+			# ELFv2 (glibc does not support ELFv1 on LE)
+			ppc64   /lib64/ld64.so.2
+		)
+		;;
+	big)
+		ldso_abi_list+=(
+			# arm
+			arm64   /lib/ld-linux-aarch64_be.so.1
+			# ELFv1 (glibc does not support ELFv2 on BE)
+			ppc64   /lib64/ld64.so.1
+		)
+		;;
+	esac
+	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+	fi
+	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+		ldso_abi=${ldso_abi_list[i]}
+		has ${ldso_abi} $(get_install_abis) || continue
+
+		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
+			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+		fi
+	done
+
+	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
+	# the runtime loader name, see also https://xkcd.com/927/
+	# Normally, in Gentoo one should never come across executables that require this.
+	# However, binary commercial packages are known to adhere to weird practices.
+	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
+	local lsb_ldso_name native_ldso_name lsb_ldso_abi
+	local lsb_ldso_abi_list=(
+		# x86
+		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
+	)
+	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
+		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
+		native_ldso_name=${lsb_ldso_abi_list[i+1]}
+		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
+		has ${lsb_ldso_abi} $(get_install_abis) || continue
+
+		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
+			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
+		fi
+	done
+
+	# With devpts under Linux mounted properly, we do not need the pt_chown
+	# binary to be setuid.  This is because the default owners/perms will be
+	# exactly what we want.
+	if ! use suid ; then
+		find "${ED}" -name pt_chown -exec chmod -s {} +
+	fi
+
+	#################################################################
+	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+	#################################################################
+
+	# Make sure we install some symlink hacks so that when we build
+	# a 2nd stage cross-compiler, gcc finds the target system
+	# headers correctly.  See gcc/doc/gccinstall.info
+	if is_crosscompile ; then
+		# We need to make sure that /lib and /usr/lib always exists.
+		# gcc likes to use relative paths to get to its multilibs like
+		# /usr/lib/../lib64/.  So while we don't install any files into
+		# /usr/lib/, we do need it to exist.
+		keepdir $(alt_prefix)/lib
+		keepdir $(alt_prefix)/usr/lib
+
+		dosym usr/include $(alt_prefix)/sys-include
+		return 0
+	fi
+
+	# Files for Debian-style locale updating
+	dodir /usr/share/i18n
+	sed \
+		-e "/^#/d" \
+		-e "/SUPPORTED-LOCALES=/d" \
+		-e "s: \\\\::g" -e "s:/: :g" \
+		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+		|| die "generating /usr/share/i18n/SUPPORTED failed"
+
+	cd "${S}" || die
+
+	# Install misc network config files
+	insinto /etc
+	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
+
+	if use nscd ; then
+		doins nscd/nscd.conf
+
+		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
+
+		local nscd_args=(
+			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+		)
+
+		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+		use systemd && systemd_dounit nscd/nscd.service
+		newtmpfiles nscd/nscd.tmpfiles nscd.conf
+	fi
+
+	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+	doenvd "${T}"/00glibc
+
+	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+		[[ -s ${d} ]] && dodoc ${d}
+	done
+	dodoc -r ChangeLog.old
+
+	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
+	# creation of the "factory" symlink in pkg_postinst().
+	rm -f "${ED}"/etc/localtime
+
+	# Generate all locales if this is a native build as locale generation
+	if use compile-locales && ! is_crosscompile ; then
+		run_locale_gen --inplace-glibc "${ED}/"
+	fi
+}
+
+glibc_headers_install() {
+	local builddir=$(builddir "headers")
+	cd "${builddir}"
+	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+
+	insinto $(alt_headers)/gnu
+	doins "${S}"/include/gnu/stubs.h
+
+	# Make sure we install the sys-include symlink so that when
+	# we build a 2nd stage cross-compiler, gcc finds the target
+	# system headers correctly.  See gcc/doc/gccinstall.info
+	dosym usr/include $(alt_prefix)/sys-include
+}
+
+src_install() {
+	if just_headers ; then
+		export ABI=default
+		glibc_headers_install
+		return
+	fi
+
+	foreach_abi glibc_do_src_install
+
+	if ! use static-libs ; then
+		einfo "Not installing static glibc libraries"
+		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
+	fi
+}
+
+# Simple test to make sure our new glibc isn't completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+	cd / #228809
+
+	# We enter ${ED} so to avoid trouble if the path contains
+	# special characters; for instance if the path contains the
+	# colon character (:), then the linker will try to split it
+	# and look for the libraries in an unexpected place. This can
+	# lead to unsafe code execution if the generated prefix is
+	# within a world-writable directory.
+	# (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})
+		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+		case ${striptest} in
+		*"statically linked"*) continue;;
+		*"ASCII text"*) continue;;
+		esac
+		# 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 \
+		${newldso} --library-path . ${x} > /dev/null \
+			|| die "simple run test (${x}) failed"
+	done
+
+	popd >/dev/null
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	einfo "Checking general environment sanity."
+	sanity_prechecks
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+	# Default /etc/hosts.conf:multi to on for systems with small dbs.
+	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+		einfo "Defaulting /etc/host.conf:multi to on"
+	fi
+
+	[[ -n ${ROOT} ]] && return 0
+	[[ -d ${ED}/$(get_libdir) ]] || return 0
+	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
+
+	if [[ -L ${EROOT}/usr/lib/locale ]]; then
+		# Help portage migrate this to a directory
+		# 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 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
+}
+
+glibc_refresh_ldconfig() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+
+	# Version check could be added to avoid unnecessary work, but ldconfig
+	# should finish quickly enough to not matter.
+	ebegin "Refreshing ld.so.cache"
+	ldconfig -i
+	if ! eend $?; then
+		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
+		ewarn "before you manually do so (ldconfig -i)."
+	fi
+}
+
+pkg_postinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
+		# Generate fastloading iconv module configuration file.
+		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+	fi
+
+	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
+		# handling has changed as well, which means stale ldconfig auxiliary
+		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
+		# every C++ application) / libgomp etc., among other breakages.
+		#
+		# To fix this, simply refresh the ld.so.cache without using the
+		# auxiliary cache if we're natively installing on loong. This should
+		# be done relatively soon because we want to minimize the breakage
+		# window for the affected programs.
+		use loong && glibc_refresh_ldconfig
+
+		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 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"
+				ewarn "  sys-auth/libnss-nis"
+				ewarn "Install it now to keep your NIS setup working."
+				ewarn ""
+			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
+}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-10-10  7:11 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-10-10  7:11 UTC (permalink / raw
  To: gentoo-commits

commit:     1997e1d80ff54054247d8e9e0a123c60cd937e5f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 10 07:09:30 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Oct 10 07:11:11 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1997e1d8

sys-libs/glibc: keyword 2.39-r11 (patchlevel 11)

Patchset changelog 2.39-10..2.39-11
a67049643a (HEAD -> gentoo/2.39, tag: gentoo/glibc-2.39-11, gentoo/gentoo/2.39) Disable _TIME_BITS if the compiler defaults to it
3fee29bcf1 Disable _FILE_OFFSET_BITS if the compiler defaults to it

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r11.ebuild b/sys-libs/glibc/glibc-2.39-r11.ebuild
index 922b3f794c97..e512d46cd6e4 100644
--- a/sys-libs/glibc/glibc-2.39-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r11.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-11-02  3:23 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-11-02  3:23 UTC (permalink / raw
  To: gentoo-commits

commit:     d191b149136aa24fb9dbb29ab02e2cf2c17aa4df
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  2 03:23:07 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov  2 03:23:07 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d191b149

sys-libs/glibc: Stabilize 2.40-r5 arm64, #942687

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.40-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.40-r5.ebuild b/sys-libs/glibc/glibc-2.40-r5.ebuild
index 5ad8b411f5b0..806afc4cb84e 100644
--- a/sys-libs/glibc/glibc-2.40-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.40-r5.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-11-02  3:23 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-11-02  3:23 UTC (permalink / raw
  To: gentoo-commits

commit:     eaf98991ffcd7ed169bde41f2f431d03667d42c3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  2 03:23:06 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov  2 03:23:06 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eaf98991

sys-libs/glibc: Stabilize 2.39-r11 arm64, #942687

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r11.ebuild b/sys-libs/glibc/glibc-2.39-r11.ebuild
index e512d46cd6e4..e634ca5c0a6c 100644
--- a/sys-libs/glibc/glibc-2.39-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r11.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-11-02  3:47 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-11-02  3:47 UTC (permalink / raw
  To: gentoo-commits

commit:     f150b2f2f6dbd9556336be28a9bdb742fb3fa4d4
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  2 03:46:40 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov  2 03:46:40 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f150b2f2

sys-libs/glibc: Stabilize 2.39-r11 ppc, #942687

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r11.ebuild b/sys-libs/glibc/glibc-2.39-r11.ebuild
index e634ca5c0a6c..26250da47957 100644
--- a/sys-libs/glibc/glibc-2.39-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r11.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-11-02  3:47 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-11-02  3:47 UTC (permalink / raw
  To: gentoo-commits

commit:     5a034c0f90e78f40e3e090466e3ea4e709362b76
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  2 03:46:41 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov  2 03:46:41 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a034c0f

sys-libs/glibc: Stabilize 2.40-r5 ppc, #942687

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.40-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.40-r5.ebuild b/sys-libs/glibc/glibc-2.40-r5.ebuild
index 806afc4cb84e..bd9e22a22339 100644
--- a/sys-libs/glibc/glibc-2.40-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.40-r5.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-11-02  8:49 Michał Górny
  0 siblings, 0 replies; 1076+ messages in thread
From: Michał Górny @ 2024-11-02  8:49 UTC (permalink / raw
  To: gentoo-commits

commit:     108b72fe002408081ba501c2e8abf7b9f5c8166b
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  2 08:49:19 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Nov  2 08:49:19 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=108b72fe

sys-libs/glibc: Stabilize 2.39-r11 amd64, #942687

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r11.ebuild b/sys-libs/glibc/glibc-2.39-r11.ebuild
index 26250da47957..59ef3393a872 100644
--- a/sys-libs/glibc/glibc-2.39-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r11.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-11-02  8:49 Michał Górny
  0 siblings, 0 replies; 1076+ messages in thread
From: Michał Górny @ 2024-11-02  8:49 UTC (permalink / raw
  To: gentoo-commits

commit:     65b7215886bc3242205ef490d8264035f739cb2d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  2 08:49:20 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Nov  2 08:49:20 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65b72158

sys-libs/glibc: Stabilize 2.40-r5 amd64, #942687

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 sys-libs/glibc/glibc-2.40-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.40-r5.ebuild b/sys-libs/glibc/glibc-2.40-r5.ebuild
index bd9e22a22339..c61cc3b31630 100644
--- a/sys-libs/glibc/glibc-2.40-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.40-r5.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-11-02 11:23 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-11-02 11:23 UTC (permalink / raw
  To: gentoo-commits

commit:     e11709ebca13c55d8f850af999137f1ece804314
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  2 11:23:03 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Nov  2 11:23:03 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e11709eb

sys-libs/glibc: Stabilize 2.40-r5 x86, #942687

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.40-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.40-r5.ebuild b/sys-libs/glibc/glibc-2.40-r5.ebuild
index c61cc3b31630..325f14d73675 100644
--- a/sys-libs/glibc/glibc-2.40-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.40-r5.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-11-02 11:23 Arthur Zamarin
  0 siblings, 0 replies; 1076+ messages in thread
From: Arthur Zamarin @ 2024-11-02 11:23 UTC (permalink / raw
  To: gentoo-commits

commit:     cc150268d017acfc788e8fb28e5160f39ebecd10
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  2 11:23:02 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Nov  2 11:23:02 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cc150268

sys-libs/glibc: Stabilize 2.39-r11 x86, #942687

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r11.ebuild b/sys-libs/glibc/glibc-2.39-r11.ebuild
index 59ef3393a872..719430c0cbb4 100644
--- a/sys-libs/glibc/glibc-2.39-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r11.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-11-03  4:40 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-11-03  4:40 UTC (permalink / raw
  To: gentoo-commits

commit:     e0b70861c82fedfefb1915df3a18071c76dd0b76
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  3 04:38:54 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Nov  3 04:38:54 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e0b70861

sys-libs/glibc: Stabilize 2.39-r11 ppc64, #942687

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r11.ebuild b/sys-libs/glibc/glibc-2.39-r11.ebuild
index 719430c0cbb4..d42b4f42bc0c 100644
--- a/sys-libs/glibc/glibc-2.39-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r11.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-11-03  4:40 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-11-03  4:40 UTC (permalink / raw
  To: gentoo-commits

commit:     f8be78daae2ef30fcc82a6faa350834a8005ae83
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  3 04:38:55 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Nov  3 04:38:55 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8be78da

sys-libs/glibc: Stabilize 2.40-r5 ppc64, #942687

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.40-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.40-r5.ebuild b/sys-libs/glibc/glibc-2.40-r5.ebuild
index 325f14d73675..01aac3024740 100644
--- a/sys-libs/glibc/glibc-2.40-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.40-r5.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ppc ~ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-11-03 17:27 Andreas K. Hüttel
  0 siblings, 0 replies; 1076+ messages in thread
From: Andreas K. Hüttel @ 2024-11-03 17:27 UTC (permalink / raw
  To: gentoo-commits

commit:     0569a9c484d52ab6fe5ae1011ac9a827db3c56b7
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  3 17:27:31 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Nov  3 17:27:31 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0569a9c4

sys-libs/glibc: drop 2.39-r9, 2.39-r10, 2.40-r4

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/Manifest              |    3 -
 sys-libs/glibc/glibc-2.39-r10.ebuild | 1751 ----------------------------------
 sys-libs/glibc/glibc-2.39-r9.ebuild  | 1751 ----------------------------------
 sys-libs/glibc/glibc-2.40-r4.ebuild  | 1751 ----------------------------------
 4 files changed, 5256 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index b336d7dbbc6b..06b1ca88e327 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -21,12 +21,9 @@ DIST glibc-2.37-patches-12.tar.xz 83716 BLAKE2B 123951d94dad6c22150c4ef2299bcaaf
 DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c
 DIST glibc-2.38-patches-13.tar.xz 92708 BLAKE2B b2f05a793c92ea0b7901d2124fcd968fa846fdf687f8cbdbc17795c33fae2d538133fae66d575c5b98a7a05a29f9f816e7ecd45f3be5ed10ef65adbf92c7fc4d SHA512 24e45a88fa7676ef22a7e2bb864dff27262f69900c4ef76d21c6fee498d728949b6f5d03dd094d1774a66a8a47b779bf4b16ee31e5306bcdb55cedcc0a1c5e9f
 DIST glibc-2.38.tar.xz 18913712 BLAKE2B f9b039f0ef98a7dd8e1cba228ed10286b9e4fbe4dd89af4d26fa5c4e4cf266f19c2746b44d797ce54739d86499e74cf334aaf311bcf6e30120fd7748453e653f SHA512 a6dd5e42dcd63d58e2820c783522c8c895890b6e8c8e6c83b025553de0cc77cdf227e7044e431ead98c89c68a9ce4dd63509b47e647775fb2075f011849c1900
-DIST glibc-2.39-patches-10.tar.xz 193260 BLAKE2B be13f61b1380cda005ef877e6c329b2d042e756b85b4711c502495074d28af35a2a4998641e2a317888105d260e0ec5c6a7f2cbdd1e68fd9ff95f88d680616d6 SHA512 8df0f9181c9129fda4e84d46ccd0bd0c6f8ecec93c0c702830b02241d001f973351187a1299dc905685907ffda6b3605043ccfd1c08fd92d7e5c358070a760d0
 DIST glibc-2.39-patches-11.tar.xz 192784 BLAKE2B fef42e0bd2a3341f41cac56dc878dcc95b7f521ffb27686a9109fe92e0458e903a24e763db17631b8ae6c1e8de7add2a11979b970689b2378aeb6ef29da7ceb6 SHA512 9daf2c57d178c7ce9d98ee454f680280738b37571bbbecc1724282e4866df29b78e60de40ad81a6efcc0a75b45d08148cb1a5f942ae7e308ae6fa63f9671b7de
 DIST glibc-2.39-patches-6.tar.xz 87600 BLAKE2B 7bb24a16fb64ed07a7477dad075dfedd59ab8d0d4ab3032273684405fd690a863a84fe1f859a07faab3ccd4663ba4f896ca37303cf2a4658ab1662732c50e860 SHA512 d48de19e9e33ef334cdbd63b6ceaddff12424477193f6bb0876105e193f2aba44cb48c33aebc47546db76dc229849cc22f884a68971bbc23994769b64bcd345c
-DIST glibc-2.39-patches-9.tar.xz 110948 BLAKE2B b958561bbc0fefa5982f0aa16dd02cc9cbd015d30d203c02d9ee72605aa51c3e25fac39759487c0deb382a793e3e0274e5585c5a4bd0036bcfaa30fc7dad9021 SHA512 d954a846c4308d4e16d3e878f1ed9ec62f3d78328043289a38cb15148ccf6b431e4a0f185e138300c141ba7e63247922f916ecbab2c8eeaa99d31c54b1ebd0fb
 DIST glibc-2.39.tar.xz 18520988 BLAKE2B 9d98459a2d58401e07c081e0d841935b23998da75a7eb5a7ebd23a1f9ebab99dee623fe166397c1b6c926960c570f62dbca5cb3b5ce84a918adff6b7a15e16bb SHA512 818f58172a52815b4338ea9f2a69ecaa3335492b9f8f64cbf8afb24c0d737982341968ecd79631cae3d3074ab0ae4bc6056fc4ba3ffe790849dc374835cd57e2
-DIST glibc-2.40-patches-4.tar.xz 84180 BLAKE2B b64f9d75b8e85e1fa2f0cc685b4d34e9b23e790b57599586263210fa6981bacce31ed657b3921a8aec70fc5cb49676465fd237ed4c55a7116ba04fec4a06d667 SHA512 2efe04a4666540fb885c274f4d1aba4a91510c9dcaf2b9f2ad6316395691eb3458e27a2e4f12d45ea08335de58ef8e3895a3e32a603e6572d8179ffc32a66661
 DIST glibc-2.40-patches-5.tar.xz 87376 BLAKE2B b09b9d2c8e45c0b494223cd01effb14ef205b030f2aeb76e1d7d289997258c1e46d85f8f4ad761e22afc35b1f4747fbca51d7caf252181c7b054b6a3e6bd2bfe SHA512 bf4776c27e5d962d2774afbed2236996a712a6127e5fdccd051af212d86a7e699a932cf4cb22f5516d513b9490b91d5e145727035e845cd4ef290985ac3dc524
 DIST glibc-2.40.tar.xz 18752204 BLAKE2B 8593cab5b2549b77159b6866fbb40b917e491fd5bc0814f7f85b6529166d78d4583436450c479b86cdfe468304fc4d2a9ba8294230a55dbc4c15e89c3ab6c000 SHA512 33caf91dbfddde6480b7cdf7a68b36aff8c522bfee56160af26af297f1b768668edb08bc4e1a7ff61c64721e3c1d49c347a5dd01c5edd3b914ee6479c8b27885
 DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238

diff --git a/sys-libs/glibc/glibc-2.39-r10.ebuild b/sys-libs/glibc/glibc-2.39-r10.ebuild
deleted file mode 100644
index ab91a718940c..000000000000
--- a/sys-libs/glibc/glibc-2.39-r10.ebuild
+++ /dev/null
@@ -1,1751 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..12} )
-TMPFILES_OPTIONAL=1
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=10
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-# Minimum systemd version needed (which contains any new syscall changes for
-# its seccomp filter!). Please double check this!
-MIN_SYSTEMD_VER="254.9-r1"
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 )"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# - similarly, valgrind requires knowledge about symbols in ld.so:
-#	bug #920753
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-
-	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
-	tst-sched1
-
-	# Fails regularly, unreliable
-	tst-valgrind-smoke
-
-	# https://sourceware.org/bugzilla/show_bug.cgi?id=31877 (bug #927973)
-	tst-shstk-legacy-1g
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
-		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
-		STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' \
-					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
-					| grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-
-		# Allow -O2 and -O3, but nothing else for now.
-		# TODO: Test -Os, -Oz.
-		if ! is-flagq '-O@(2|3)' ; then
-			# Lock glibc at -O2. We want to be conservative here.
-			filter-flags '-O?'
-			append-flags -O2
-		fi
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# Fails to link (bug #940709) in some cases but even if it manages to,
-	# subtle runtime breakage will occur because the linker scripts need
-	# adaptation. Mentioned in PR21557#c0.
-	filter-ldflags '-Wl,--gc-sections'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #798774
-	filter-flags -fno-semantic-interposition
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if ! use cet; then
-		case ${ABI}-${CTARGET} in
-			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
-				append-flags '-fcf-protection=none'
-				;;
-			arm64-aarch64*)
-				append-flags '-mbranch-protection=none'
-				;;
-		esac
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# glibc does not work with non-bfd (for various reasons):
-	# * gold (bug #269274)
-	# * mold (bug #860900)
-	tc-ld-force-bfd
-
-	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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-	export glibc__ORIG_CPP=${CPP}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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})"
-		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-	export glibc__GLIBC_CPP=${CPP}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking if the system can execute 32-bit binaries"
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			if [[ $STAT -ne 0 ]]; then
-				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
-				eerror "Seek support otherwise."
-				die "Unable to execute 32-bit binaries"
-			fi
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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 supporting IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	case ${ABI}-${CTARGET} in
-		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-		if [[ "$(nice)" == "19" ]] ; then
-			# Expects to be able to increase niceness, which it can't do if
-			# already at the highest nice value
-			XFAIL_TEST_LIST+=( "tst-nice" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	# valgrind requires knowledge about ld.so symbols.
-	dostrip -x $(alt_libdir)/ld-*.so*
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
-			"${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
-			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.39-r9.ebuild b/sys-libs/glibc/glibc-2.39-r9.ebuild
deleted file mode 100644
index e0df00dcd639..000000000000
--- a/sys-libs/glibc/glibc-2.39-r9.ebuild
+++ /dev/null
@@ -1,1751 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..12} )
-TMPFILES_OPTIONAL=1
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=9
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-# Minimum systemd version needed (which contains any new syscall changes for
-# its seccomp filter!). Please double check this!
-MIN_SYSTEMD_VER="254.9-r1"
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 )"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# - similarly, valgrind requires knowledge about symbols in ld.so:
-#	bug #920753
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-
-	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
-	tst-sched1
-
-	# Fails regularly, unreliable
-	tst-valgrind-smoke
-
-	# https://sourceware.org/bugzilla/show_bug.cgi?id=31877 (bug #927973)
-	tst-shstk-legacy-1g
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
-		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
-		STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' \
-					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
-					| grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-
-		# Allow -O2 and -O3, but nothing else for now.
-		# TODO: Test -Os, -Oz.
-		if ! is-flagq '-O@(2|3)' ; then
-			# Lock glibc at -O2. We want to be conservative here.
-			filter-flags '-O?'
-			append-flags -O2
-		fi
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# Fails to link (bug #940709) in some cases but even if it manages to,
-	# subtle runtime breakage will occur because the linker scripts need
-	# adaptation. Mentioned in PR21557#c0.
-	filter-ldflags '-Wl,--gc-sections'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #798774
-	filter-flags -fno-semantic-interposition
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if ! use cet; then
-		case ${ABI}-${CTARGET} in
-			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
-				append-flags '-fcf-protection=none'
-				;;
-			arm64-aarch64*)
-				append-flags '-mbranch-protection=none'
-				;;
-		esac
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# glibc does not work with non-bfd (for various reasons):
-	# * gold (bug #269274)
-	# * mold (bug #860900)
-	tc-ld-force-bfd
-
-	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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-	export glibc__ORIG_CPP=${CPP}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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})"
-		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-	export glibc__GLIBC_CPP=${CPP}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking if the system can execute 32-bit binaries"
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			if [[ $STAT -ne 0 ]]; then
-				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
-				eerror "Seek support otherwise."
-				die "Unable to execute 32-bit binaries"
-			fi
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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 supporting IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	case ${ABI}-${CTARGET} in
-		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-		if [[ "$(nice)" == "19" ]] ; then
-			# Expects to be able to increase niceness, which it can't do if
-			# already at the highest nice value
-			XFAIL_TEST_LIST+=( "tst-nice" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	# valgrind requires knowledge about ld.so symbols.
-	dostrip -x $(alt_libdir)/ld-*.so*
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
-			"${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
-			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}

diff --git a/sys-libs/glibc/glibc-2.40-r4.ebuild b/sys-libs/glibc/glibc-2.40-r4.ebuild
deleted file mode 100644
index d4fc0765e8cc..000000000000
--- a/sys-libs/glibc/glibc-2.40-r4.ebuild
+++ /dev/null
@@ -1,1751 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
-# Please read & adapt the page as necessary if obsolete.
-
-PYTHON_COMPAT=( python3_{10..13} )
-TMPFILES_OPTIONAL=1
-
-EMULTILIB_PKG="true"
-
-# Gentoo patchset (ignored for live ebuilds)
-PATCH_VER=4
-PATCH_DEV=dilfridge
-
-# gcc mulitilib bootstrap files version
-GCC_BOOTSTRAP_VER=20201208
-
-# systemd integration version
-GLIBC_SYSTEMD_VER=20210729
-
-# 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"
-
-# Minimum systemd version needed (which contains any new syscall changes for
-# its seccomp filter!). Please double check this!
-MIN_SYSTEMD_VER="254.9-r1"
-
-inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
-	multilib systemd multiprocessing tmpfiles
-
-DESCRIPTION="GNU libc C library"
-HOMEPAGE="https://www.gnu.org/software/libc/"
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-else
-	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
-	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
-fi
-
-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 )"
-
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
-SLOT="2.2"
-IUSE="audit caps cet compile-locales custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
-
-# Here's how the cross-compile logic breaks down ...
-#  CTARGET - machine that will target the binaries
-#  CHOST   - machine that will host the binaries
-#  CBUILD  - machine that will build the binaries
-# If CTARGET != CHOST, it means you want a libc for cross-compiling.
-# If CHOST != CBUILD, it means you want to cross-compile the libc.
-#  CBUILD = CHOST = CTARGET    - native build/install
-#  CBUILD != (CHOST = CTARGET) - cross-compile a native build
-#  (CBUILD = CHOST) != CTARGET - libc for cross-compiler
-#  CBUILD != CHOST != CTARGET  - cross-compile a libc for a cross-compiler
-# For install paths:
-#  CHOST = CTARGET  - install into /
-#  CHOST != CTARGET - install into /usr/CTARGET/
-#
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-# Note [Disable automatic stripping]
-# Disabling automatic stripping for a few reasons:
-# - portage's attempt to strip breaks non-native binaries at least on
-#   arm: bug #697428
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread
-#   enumeration: bug #697910. This is quite subtle:
-#   * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
-#   * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
-#     via 'ps_pglobal_lookup' symbol defined in gdb.
-#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
-#     known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
-#     (unexported) is used to sanity check compatibility before enabling
-#     debugging.
-#     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
-#   * normal 'strip' command trims '.symtab'
-#   Thus our main goal here is to prevent 'libpthread.so.0' from
-#   losing it's '.symtab' entries.
-# - similarly, valgrind requires knowledge about symbols in ld.so:
-#	bug #920753
-# As Gentoo's strip does not allow us to pass less aggressive stripping
-# options and does not check the machine target we strip selectively.
-
-# We need a new-enough binutils/gcc to match upstream baseline.
-# Also we need to make sure our binutils/gcc supports TLS,
-# and that gcc already contains the hardened patches.
-# Lastly, let's avoid some openssh nastiness, bug 708224, as
-# convenience to our users.
-
-IDEPEND="
-	!compile-locales? ( sys-apps/locale-gen )
-"
-BDEPEND="
-	${PYTHON_DEPS}
-	>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	sys-devel/bison
-	compile-locales? ( sys-apps/locale-gen )
-	doc? (
-		dev-lang/perl
-		sys-apps/texinfo
-	)
-	test? (
-		dev-lang/perl
-		>=net-dns/libidn2-2.3.0
-	)
-"
-COMMON_DEPEND="
-	gd? ( media-libs/gd:2= )
-	nscd? ( selinux? (
-		audit? ( sys-process/audit )
-		caps? ( sys-libs/libcap )
-	) )
-	suid? ( caps? ( sys-libs/libcap ) )
-	selinux? ( sys-libs/libselinux )
-	systemtap? ( dev-debug/systemtap )
-"
-DEPEND="${COMMON_DEPEND}
-"
-RDEPEND="${COMMON_DEPEND}
-	!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
-	!<sys-apps/systemd-${MIN_SYSTEMD_VER}
-	perl? ( dev-lang/perl )
-"
-
-RESTRICT="!test? ( test )"
-
-if [[ ${CATEGORY} == cross-* ]] ; then
-	BDEPEND+=" !headers-only? (
-		>=${CATEGORY}/binutils-2.27
-		>=${CATEGORY}/gcc-6.2
-	)"
-	[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
-else
-	BDEPEND+="
-		>=sys-devel/binutils-2.27
-		>=sys-devel/gcc-6.2
-	"
-	DEPEND+=" virtual/os-headers "
-	RDEPEND+="
-		>=net-dns/libidn2-2.3.0
-		vanilla? ( !sys-libs/timezone-data )
-	"
-	PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
-fi
-
-# Ignore tests whitelisted below
-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=(
-	# 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
-
-	# The following tests fail only inside portage
-	# https://bugs.gentoo.org/831267
-	tst-system
-	tst-strerror
-	tst-strsignal
-
-	# Fails with certain PORTAGE_NICENESS/PORTAGE_SCHEDULING_POLICY
-	tst-sched1
-
-	# Fails regularly, unreliable
-	tst-valgrind-smoke
-
-	# https://sourceware.org/bugzilla/show_bug.cgi?id=31877 (bug #927973)
-	tst-shstk-legacy-1g
-)
-
-XFAIL_NSPAWN_TEST_LIST=(
-	# These tests need to be adapted to handle EPERM/ENOSYS(?) properly
-	# upstream, as systemd-nspawn's default seccomp whitelist is too strict.
-	# https://sourceware.org/PR30603
-	test-errno-linux
-	tst-bz21269
-	tst-mlock2
-	tst-ntp_gettime
-	tst-ntp_gettime-time64
-	tst-ntp_gettimex
-	tst-ntp_gettimex-time64
-	tst-pkey
-	tst-process_mrelease
-	tst-adjtime
-	tst-adjtime-time64
-	tst-clock2
-	tst-clock2-time64
-
-	# These fail if --suppress-sync and/or low priority is set
-	tst-sync_file_range
-	test-errno
-)
-
-#
-# Small helper functions
-#
-
-dump_build_environment() {
-	einfo ==== glibc build environment ========================================================
-	local v
-	for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX CPP LD \
-		{AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY \
-		STRINGS OBJDUMP READELF; do
-		einfo " $(printf '%15s' ${v}:)   ${!v}"
-	done
-	einfo =====================================================================================
-}
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	is_crosscompile && use headers-only
-}
-
-alt_prefix() {
-	is_crosscompile && echo /usr/${CTARGET}
-}
-
-# This prefix is applicable to CHOST when building against this
-# glibc. It is baked into the library at configure time.
-host_eprefix() {
-	is_crosscompile || echo "${EPREFIX}"
-}
-
-# This prefix is applicable to CBUILD when building against this
-# glibc. It determines the destination path at install time.
-build_eprefix() {
-	is_crosscompile && echo "${EPREFIX}"
-}
-
-# We need to be able to set alternative headers for compiling for non-native
-# platform. Will also become useful for testing kernel-headers without screwing
-# up the whole system.
-alt_headers() {
-	echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
-}
-
-alt_build_headers() {
-	if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-		ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
-		if tc-is-cross-compiler ; then
-			ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
-			if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
-				local header_path=$(echo '#include <linux/version.h>' \
-					| $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 \
-					| grep -o '[^"]*linux/version.h')
-				ALT_BUILD_HEADERS=${header_path%/linux/version.h}
-			fi
-		fi
-	fi
-	echo "${ALT_BUILD_HEADERS}"
-}
-
-alt_libdir() {
-	echo $(alt_prefix)/$(get_libdir)
-}
-alt_usrlibdir() {
-	echo $(alt_prefix)/usr/$(get_libdir)
-}
-
-builddir() {
-	echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
-}
-
-do_compile_test() {
-	local ret save_cflags=${CFLAGS}
-	CFLAGS+=" $1"
-	shift
-
-	pushd "${T}" >/dev/null
-
-	rm -f glibc-test*
-	printf '%b' "$*" > glibc-test.c
-
-	# We assume CC is already set up.
-	nonfatal emake glibc-test
-	ret=$?
-
-	popd >/dev/null
-
-	CFLAGS=${save_cflags}
-	return ${ret}
-}
-
-do_run_test() {
-	local ret
-
-	if [[ ${MERGE_TYPE} == "binary" ]] ; then
-		# ignore build failures when installing a binary package #324685
-		do_compile_test "" "$@" 2>/dev/null || return 0
-	else
-		if ! do_compile_test "" "$@" ; then
-			ewarn "Simple build failed ... assuming this is desired #324685"
-			return 0
-		fi
-	fi
-
-	pushd "${T}" >/dev/null
-
-	./glibc-test
-	ret=$?
-	rm -f glibc-test*
-
-	popd >/dev/null
-
-	return ${ret}
-}
-
-setup_target_flags() {
-	# This largely mucks with compiler flags.  None of which should matter
-	# when building up just the headers.
-	just_headers && return 0
-
-	case $(tc-arch) in
-		x86)
-			# -march needed for #185404 #199334
-			# TODO: When creating the first glibc cross-compile, this test will
-			# always fail as it does a full link which in turn requires glibc.
-			# Probably also applies when changing multilib profile settings (e.g.
-			# enabling x86 when the profile was amd64-only previously).
-			# We could change main to _start and pass -nostdlib here so that we
-			# only test the gcc code compilation.  Or we could do a compile and
-			# then look for the symbol via scanelf.
-			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
-				local t=${CTARGET_OPT:-${CTARGET}}
-				t=${t%%-*}
-				filter-flags '-march=*'
-				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.
-			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"
-			fi
-		;;
-		mips)
-			# The mips abi cannot support the GNU style hashes. #233233
-			filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
-		;;
-		ppc|ppc64)
-			# Many arch-specific implementations do not work on ppc with
-			# cache-block not equal to 128 bytes. This breaks memset:
-			#   https://sourceware.org/PR26522
-			#   https://bugs.gentoo.org/737996
-			# Use default -mcpu=. For ppc it means non-multiarch setup.
-			filter-flags '-mcpu=*'
-		;;
-		sparc)
-			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
-			filter-flags "-fcall-used-g7"
-			append-flags "-fcall-used-g6"
-
-			local cpu
-			case ${CTARGET} in
-			sparc64-*)
-				cpu="sparc64"
-				case $(get-flag mcpu) in
-				v9)
-					# We need to force at least v9a because the base build doesn't
-					# work with just v9.
-					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
-					append-flags "-Wa,-xarch=v9a"
-					;;
-				esac
-				;;
-			sparc-*)
-				case $(get-flag mcpu) in
-				v8|supersparc|hypersparc|leon|leon3)
-					cpu="sparcv8"
-					;;
-				*)
-					cpu="sparcv9"
-					;;
-				esac
-			;;
-			esac
-			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
-		;;
-	esac
-}
-
-setup_flags() {
-	# Make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-
-	# Store our CFLAGS because it's changed depending on which CTARGET
-	# we are building when pulling glibc on a multilib profile
-	CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
-	CFLAGS=${CFLAGS_BASE}
-	CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
-	CXXFLAGS=${CXXFLAGS_BASE}
-	ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
-	ASFLAGS=${ASFLAGS_BASE}
-
-	# Allow users to explicitly avoid flag sanitization via
-	# USE=custom-cflags.
-	if ! use custom-cflags; then
-		# Over-zealous CFLAGS can often cause problems.  What may work for one
-		# person may not work for another.  To avoid a large influx of bugs
-		# relating to failed builds, we strip most CFLAGS out to ensure as few
-		# problems as possible.
-		strip-flags
-
-		# Allow -O2 and -O3, but nothing else for now.
-		# TODO: Test -Os, -Oz.
-		if ! is-flagq '-O@(2|3)' ; then
-			# Lock glibc at -O2. We want to be conservative here.
-			filter-flags '-O?'
-			append-flags -O2
-		fi
-	fi
-
-	strip-unsupported-flags
-	filter-lto
-	filter-flags -m32 -m64 '-mabi=*'
-
-	# glibc aborts if rpath is set by LDFLAGS
-	filter-ldflags '-Wl,-rpath=*'
-
-	# ld can't use -r & --relax at the same time, bug #788901
-	# https://sourceware.org/PR27837
-	filter-ldflags '-Wl,--relax'
-
-	# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
-	# anyway because glibc already handles this by itself.
-	filter-ldflags '-Wl,--dynamic-linker=*'
-
-	# Fails to link (bug #940709) in some cases but even if it manages to,
-	# subtle runtime breakage will occur because the linker scripts need
-	# adaptation. Mentioned in PR21557#c0.
-	filter-ldflags '-Wl,--gc-sections'
-
-	# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
-	# we have to do that here already so mips can filter it out again :P
-	if use hash-sysv-compat ; then
-		append-ldflags '-Wl,--hash-style=both'
-	fi
-
-	# #492892
-	filter-flags -frecord-gcc-switches
-
-	# #898098
-	filter-flags -fno-builtin
-
-	# #798774
-	filter-flags -fno-semantic-interposition
-
-	# #829583
-	filter-lfs-flags
-
-	unset CBUILD_OPT CTARGET_OPT
-	if use multilib ; then
-		CTARGET_OPT=$(get_abi_CTARGET)
-		[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
-	fi
-
-	setup_target_flags
-
-	if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
-		CBUILD_OPT=${CTARGET_OPT}
-	fi
-
-	# glibc's headers disallow -O0 and fail at build time:
-	#  include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
-	# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
-	replace-flags -O0 -O1
-
-	# glibc handles this internally already where it's appropriate;
-	# can't always have SSP when we're the ones setting it up, etc
-	filter-flags '-fstack-protector*'
-
-	# Similar issues as with SSP. Can't inject yourself that early.
-	filter-flags '-fsanitize=*'
-
-	# See end of bug #830454; we handle this via USE=cet
-	filter-flags '-fcf-protection=*'
-
-	# When bootstrapping, we may have a situation where
-	# CET-enabled gcc from seed is used to build CET-disabled
-	# glibc. As such, gcc implicitly enables CET if no
-	# -fcf-protection flag is passed. For a typical package it
-	# should not be a problem, but for glibc it matters as it is
-	# dealing with CET in ld.so. So if CET is supposed to be
-	# disabled for glibc, be explicit about it.
-	if ! use cet; then
-		case ${ABI}-${CTARGET} in
-			amd64-x86_64-*|x32-x86_64-*-*-gnux32)
-				append-flags '-fcf-protection=none'
-				;;
-			arm64-aarch64*)
-				append-flags '-mbranch-protection=none'
-				;;
-		esac
-	fi
-}
-
-use_multiarch() {
-	# Allow user to disable runtime arch detection in multilib.
-	use multiarch || return 1
-	# Make sure binutils is new enough to support indirect functions,
-	# #336792. This funky sed supports gold and bfd linkers.
-	local bver nver
-	bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
-	case $(tc-arch ${CTARGET}) in
-	amd64|x86) nver="2.20" ;;
-	arm)       nver="2.22" ;;
-	hppa)      nver="2.23" ;;
-	ppc|ppc64) nver="2.20" ;;
-	# ifunc support was added in 2.23, but glibc also needs
-	# machinemode which is in 2.24.
-	s390)      nver="2.24" ;;
-	sparc)     nver="2.21" ;;
-	*)         return 1 ;;
-	esac
-	ver_test ${bver} -ge ${nver}
-}
-
-# Setup toolchain variables that had historically been defined in the
-# profiles for these archs.
-setup_env() {
-	# silly users
-	unset LD_RUN_PATH
-	unset LD_ASSUME_KERNEL
-
-	if is_crosscompile || tc-is-cross-compiler ; then
-		multilib_env ${CTARGET_OPT:-${CTARGET}}
-
-		if ! use multilib ; then
-			MULTILIB_ABIS=${DEFAULT_ABI}
-		else
-			MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
-		fi
-
-		# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
-		# and fall back on CFLAGS.
-		local VAR=CFLAGS_${CTARGET//[-.]/_}
-		CFLAGS=${!VAR-${CFLAGS}}
-		einfo " $(printf '%15s' 'Manual CFLAGS:')   ${CFLAGS}"
-	fi
-
-	setup_flags
-
-	export ABI=${ABI:-${DEFAULT_ABI:-default}}
-
-	if just_headers ; then
-		# Avoid mixing host's CC and target's CFLAGS_${ABI}:
-		# At this bootstrap stage we have only binutils for
-		# target but not compiler yet.
-		einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
-		return 0
-	fi
-
-	# glibc does not work with non-bfd (for various reasons):
-	# * gold (bug #269274)
-	# * mold (bug #860900)
-	tc-ld-force-bfd
-
-	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=${glibc__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
-	export CXX=${glibc__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
-	export CPP=${glibc__ORIG_CPP:-${CPP:-$(tc-getCPP ${CTARGET})}}
-
-	# and make sure glibc__ORIG_CC and glibc__ORIG_CXX is defined now.
-	export glibc__ORIG_CC=${CC}
-	export glibc__ORIG_CXX=${CXX}
-	export glibc__ORIG_CPP=${CPP}
-
-	if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-		export glibc__force_gcc=yes
-		# once this is toggled on, it needs to stay on, since with CPP manipulated
-		# tc-is-clang does not work correctly anymore...
-	fi
-
-	if [[ ${glibc__force_gcc} == "yes" ]] ; 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 CPP="${current_gcc_path}/cpp"
-		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})"
-		export CPP="$(tc-getCPP ${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. (Why does the comment talk about CFLAGS if the code
-	# acts on CC?)
-	export glibc__GLIBC_CC=${CC}
-	export glibc__GLIBC_CXX=${CXX}
-	export glibc__GLIBC_CPP=${CPP}
-
-	export glibc__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__GLIBC_CC} ${glibc__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__GLIBC_CXX} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	export CPP="${glibc__GLIBC_CPP} ${glibc__abi_CFLAGS} ${CFLAGS}"
-
-	if is_crosscompile; then
-		# Assume worst-case bootstrap: glibc is built for the first time
-		# with ${CTARGET}-g++ 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() {
-	setup_env
-
-	local ret=0
-	local abilist=""
-	if use multilib ; then
-		abilist=$(get_install_abis)
-	else
-		abilist=${DEFAULT_ABI}
-	fi
-	local -x ABI
-	for ABI in ${abilist:-default} ; do
-		setup_env
-		einfo "Running $1 for ABI ${ABI}"
-		$1
-		: $(( ret |= $? ))
-	done
-	return ${ret}
-}
-
-glibc_banner() {
-	local b="Gentoo ${PVR}"
-	[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
-	echo "${b}"
-}
-
-# The following Kernel version handling functions are mostly copied from portage
-# source. It's better not to use linux-info.eclass here since a) it adds too
-# much magic, see bug 326693 for some of the arguments, and b) some of the
-# functions are just not provided.
-
-g_get_running_KV() {
-	uname -r
-	return $?
-}
-
-g_KV_major() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	echo "${KV%%.*}"
-}
-
-g_KV_minor() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.}
-	echo "${KV%%.*}"
-}
-
-g_KV_micro() {
-	[[ -z $1 ]] && return 1
-	local KV=$@
-	KV=${KV#*.*.}
-	echo "${KV%%[^[:digit:]]*}"
-}
-
-g_KV_to_int() {
-	[[ -z $1 ]] && return 1
-	local KV_MAJOR=$(g_KV_major "$1")
-	local KV_MINOR=$(g_KV_minor "$1")
-	local KV_MICRO=$(g_KV_micro "$1")
-	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
-	# We make version 2.2.0 the minimum version we will handle as
-	# a sanity check ... if its less, we fail ...
-	if [[ ${KV_int} -ge 131584 ]] ; then
-		echo "${KV_int}"
-		return 0
-	fi
-	return 1
-}
-
-g_int_to_KV() {
-	local version=$1 major minor micro
-	major=$((version / 65536))
-	minor=$(((version % 65536) / 256))
-	micro=$((version % 256))
-	echo ${major}.${minor}.${micro}
-}
-
-eend_KV() {
-	[[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
-	eend $?
-}
-
-get_kheader_version() {
-	printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-	$(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
-	tail -n 1
-}
-
-# We collect all sanity checks here. Consistency is not guranteed between
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
-# src_unpack.
-sanity_prechecks() {
-	# Prevent native builds from downgrading
-	if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-	   [[ -z ${ROOT} ]] && \
-	   [[ ${CBUILD} == ${CHOST} ]] && \
-	   [[ ${CHOST} == ${CTARGET} ]] ; then
-
-		# The high rev # is to allow people to downgrade between -r#
-		# versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
-		# should be fine. Hopefully we never actually use a r# this
-		# high.
-		if has_version ">${CATEGORY}/${P}-r10000" ; then
-			eerror "Sanity check to keep you from breaking your system:"
-			eerror " Downgrading glibc is not supported and a sure way to destruction."
-			[[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
-		fi
-
-		if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
-			eerror "Your old kernel is broken. You need to update it to a newer"
-			eerror "version as syscall(<bignum>) will break. See bug 279260."
-			die "Old and broken kernel."
-		fi
-	fi
-
-	if [[ ${CTARGET} == i386-* ]] ; then
-		eerror "i386 CHOSTs are no longer supported."
-		eerror "Chances are you don't actually want/need i386."
-		eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
-		die "Please fix your CHOST"
-	fi
-
-	if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
-		ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
-		ewarn "This will result in a 50% performance penalty when running with a 32bit"
-		ewarn "hypervisor, which is probably not what you want."
-	fi
-
-	# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
-	# we test for...
-	if ! is_crosscompile ; then
-		if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
-			ebegin "Checking if the system can execute 32-bit binaries"
-			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
-				"${T}/check-ia32-emulation.elf32"
-				STAT=$?
-			else
-				# Don't fail here to allow single->multi ABI switch
-				# or recover from breakage like bug #646424
-				ewarn "Failed to compile the ABI test. Broken host glibc?"
-				STAT=0
-			fi
-			rm -f "${T}/check-ia32-emulation.elf32"
-			eend $STAT
-			if [[ $STAT -ne 0 ]]; then
-				eerror "Ensure that CONFIG_IA32_EMULATION is enabled in the kernel."
-				eerror "Seek support otherwise."
-				die "Unable to execute 32-bit binaries"
-			fi
-		fi
-
-	fi
-
-	# When we actually have to compile something...
-	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
-			local run_kv build_kv want_kv
-
-			run_kv=$(g_get_running_KV)
-			build_kv=$(g_int_to_KV $(get_kheader_version))
-			want_kv=${MIN_KERN_VER}
-
-			if ! is_crosscompile && ! tc-is-cross-compiler ; then
-				# Building fails on an non-supporting kernel
-				ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
-				if ! eend_KV ${run_kv} ${want_kv} ; then
-					echo
-					eerror "You need a kernel of at least ${want_kv}!"
-					die "Kernel version too low!"
-				fi
-			fi
-
-			# Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there).
-			# It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers
-			# upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not
-			# just glibc), the whole emerge gets aborted without a good reason. We probably don't
-			# need to run this check at all given we have a dependency on the right headers,
-			# but let's leave it as-is for now.
-			if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then
-				ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
-				if ! eend_KV ${build_kv} ${want_kv} ; then
-					echo
-					eerror "You need linux-headers of at least ${want_kv}!"
-					die "linux-headers version too low!"
-				fi
-			fi
-		fi
-	fi
-}
-
-upgrade_warning() {
-	is_crosscompile && return
-
-	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
-#
-
-# pkg_pretend
-
-pkg_pretend() {
-	upgrade_warning
-}
-
-# pkg_setup
-
-pkg_setup() {
-	# see bug 682570
-	[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
-}
-
-# src_unpack
-
-src_unpack() {
-	setup_env
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
-
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patches || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
-	fi
-
-	cd "${WORKDIR}" || die
-	use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
-}
-
-# src_prepare
-
-src_prepare() {
-	local patchsetname
-	if ! use vanilla ; then
-		if [[ ${PV} == 9999* ]] ; then
-			patchsetname="from git master"
-		else
-			patchsetname="${PV}-${PATCH_VER}"
-		fi
-		einfo "Applying Gentoo Glibc patchset ${patchsetname}"
-		eapply "${WORKDIR}"/patches
-		einfo "Done."
-	fi
-
-	default
-
-	gnuconfig_update
-
-	cd "${WORKDIR}" || die
-	find . -name configure -exec touch {} +
-
-	# Fix permissions on some of the scripts.
-	chmod u+x "${S}"/scripts/*.sh
-
-	cd "${S}" || die
-}
-
-# src_configure
-
-glibc_do_configure() {
-	dump_build_environment
-
-	local myconf=()
-
-	# 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 supporting IFUNC. glibc's ./configure
-	# is not robust enough to detect proper support:
-	#    https://bugs.gentoo.org/641216
-	#    https://sourceware.org/PR22634#c0
-	case $(tc-arch ${CTARGET}) in
-		# Keep whitelist of targets where autodetection mostly works.
-		amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
-		# Blacklist everywhere else
-		*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
-	esac
-
-	case ${ABI}-${CTARGET} in
-		amd64-x86_64-*|x32-x86_64-*-*-gnux32) myconf+=( $(use_enable cet) ) ;;
-		*) ;;
-	esac
-
-	[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
-
-	myconf+=( --enable-kernel=${MIN_KERN_VER} )
-
-	# Since SELinux support is only required for nscd, only enable it if:
-	# 1. USE selinux
-	# 2. only for the primary ABI on multilib systems
-	# 3. Not a crosscompile
-	if ! is_crosscompile && use selinux ; then
-		if use multilib ; then
-			if is_final_abi ; then
-				myconf+=( --with-selinux )
-			else
-				myconf+=( --without-selinux )
-			fi
-		else
-			myconf+=( --with-selinux )
-		fi
-	else
-		myconf+=( --without-selinux )
-	fi
-
-	# Force a few tests where we always know the answer but
-	# configure is incapable of finding it.
-	if is_crosscompile ; then
-		export \
-			libc_cv_c_cleanup=yes \
-			libc_cv_forced_unwind=yes
-	fi
-
-	myconf+=(
-		--disable-werror
-		--enable-bind-now
-		--enable-fortify-source
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		$(use_enable profile)
-		$(use_with gd)
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		--sysconfdir="$(host_eprefix)/etc"
-		--localstatedir="$(host_eprefix)/var"
-		--libdir='$(prefix)'/$(get_libdir)
-		--mandir='$(prefix)'/share/man
-		--infodir='$(prefix)'/share/info
-		--libexecdir='$(libdir)'/misc/glibc
-		--with-bugurl=https://bugs.gentoo.org/
-		--with-pkgversion="$(glibc_banner)"
-		$(use_multiarch || echo --disable-multi-arch)
-		$(use_enable systemtap)
-		$(use_enable nscd)
-
-		# /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if
-		# Perl hasn't been installed inside the prefix yet and configure picks
-		# up a Perl from outside the prefix instead. configure will fail to
-		# execute Perl during configure if we're cross-compiling a prefix, but
-		# it will just disable mtrace in that case.
-		# Note: mtrace is needed by the test suite.
-		ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
-
-		# locale data is arch-independent
-		# https://bugs.gentoo.org/753740
-		libc_cv_complocaledir='${exec_prefix}/lib/locale'
-
-		# On aarch64 there is no way to override -mcpu=native, and if
-		# the current cpu does not support SVE configure fails.
-		# Let's boldly assume our toolchain can always build SVE instructions.
-		libc_cv_aarch64_sve_asm=yes
-
-		${EXTRA_ECONF}
-	)
-
-	# We rely on sys-libs/timezone-data for timezone tools normally.
-	myconf+=( $(use_enable vanilla timezone-tools) )
-
-	# These libs don't have configure flags.
-	ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
-	ac_cv_lib_cap_cap_init=$(usex caps || echo no)
-
-	# There is no configure option for this and we need to export it
-	# since the glibc build will re-run configure on itself
-	export libc_cv_rootsbindir="$(host_eprefix)/sbin"
-	export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
-
-	local builddir=$(builddir nptl)
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-	set -- "${S}"/configure "${myconf[@]}"
-	echo "$@"
-	"$@" || die "failed to configure glibc"
-
-	# If we're trying to migrate between ABI sets, we need
-	# to lie and use a local copy of gcc.  Like if the system
-	# is built with MULTILIB_ABIS="amd64 x86" but we want to
-	# add x32 to it, gcc/glibc don't yet support x32.
-	#
-	if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
-		echo 'int main(void){}' > "${T}"/test.c || die
-		if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
-			sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
-		fi
-	fi
-}
-
-glibc_headers_configure() {
-	export ABI=default
-
-	local builddir=$(builddir "headers")
-	mkdir -p "${builddir}"
-	cd "${builddir}"
-
-	# if we don't have a compiler yet, we can't really test it now ...
-	# hopefully they don't affect header generation, so let's hope for
-	# the best here ...
-	local v vars=(
-		ac_cv_header_cpuid_h=yes
-		libc_cv_{386,390,alpha,arm,hppa,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-		libc_cv_asm_cfi_directives=yes
-		libc_cv_broken_visibility_attribute=no
-		libc_cv_c_cleanup=yes
-		libc_cv_compiler_powerpc64le_binary128_ok=yes
-		libc_cv_forced_unwind=yes
-		libc_cv_gcc___thread=yes
-		libc_cv_mlong_double_128=yes
-		libc_cv_mlong_double_128ibm=yes
-		libc_cv_ppc_machine=yes
-		libc_cv_ppc_rel16=yes
-		libc_cv_predef_fortify_source=no
-		libc_cv_target_power8_ok=yes
-		libc_cv_visibility_attribute=yes
-		libc_cv_z_combreloc=yes
-		libc_cv_z_execstack=yes
-		libc_cv_z_initfirst=yes
-		libc_cv_z_nodelete=yes
-		libc_cv_z_nodlopen=yes
-		libc_cv_z_relro=yes
-		libc_mips_abi=${ABI}
-		libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
-		# These libs don't have configure flags.
-		ac_cv_lib_audit_audit_log_user_avc_message=no
-		ac_cv_lib_cap_cap_init=no
-	)
-
-	einfo "Forcing cached settings:"
-	for v in "${vars[@]}" ; do
-		einfo " ${v}"
-		export ${v}
-	done
-
-	local headers_only_arch_CPPFLAGS=()
-
-	# Blow away some random CC settings that screw things up. #550192
-	if [[ -d ${S}/sysdeps/mips ]]; then
-		pushd "${S}"/sysdeps/mips >/dev/null
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
-		sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
-
-		# Force the mips ABI to the default.  This is OK because the set of
-		# installed headers in this phase is the same between the 3 ABIs.
-		# If this ever changes, this hack will break, but that's unlikely
-		# as glibc discourages that behavior.
-		# https://crbug.com/647033
-		sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
-
-		popd >/dev/null
-	fi
-
-	local myconf=()
-
-	case ${CTARGET} in
-	aarch64*)
-		# The configure checks fail during cross-build, so disable here
-		# for headers-only
-		myconf+=(
-			--disable-mathvec
-		) ;;
-	riscv*)
-		# RISC-V interrogates the compiler to determine which target to
-		# build.  If building the headers then we don't strictly need a
-		# RISC-V compiler, so the built-in definitions that are provided
-		# along with all RISC-V compiler might not exist.  This causes
-		# glibc's RISC-V preconfigure script to blow up.  Since we're just
-		# building the headers any value will actually work here, so just
-		# pick the standard one (rv64g/lp64d) to make the build scripts
-		# happy for now -- the headers are all the same anyway so it
-		# doesn't matter.
-		headers_only_arch_CPPFLAGS+=(
-			-D__riscv_xlen=64
-			-D__riscv_flen=64
-			-D__riscv_float_abi_double=1
-			-D__riscv_atomic=1
-		) ;;
-	esac
-
-	myconf+=(
-		--disable-sanity-checks
-		--enable-hacker-mode
-		--disable-werror
-		--enable-bind-now
-		--build=${CBUILD_OPT:-${CBUILD}}
-		--host=${CTARGET_OPT:-${CTARGET}}
-		--with-headers=$(build_eprefix)$(alt_build_headers)
-		--prefix="$(host_eprefix)/usr"
-		${EXTRA_ECONF}
-	)
-
-	# Nothing is compiled here which would affect the headers for the target.
-	# So forcing CC/CFLAGS is sane.
-	local headers_only_CC=$(tc-getBUILD_CC)
-	local headers_only_CFLAGS="-O1 -pipe"
-	local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
-	local headers_only_LDFLAGS=""
-	set -- "${S}"/configure "${myconf[@]}"
-	echo \
-		"CC=${headers_only_CC}" \
-		"CFLAGS=${headers_only_CFLAGS}" \
-		"CPPFLAGS=${headers_only_CPPFLAGS}" \
-		"LDFLAGS=${headers_only_LDFLAGS}" \
-		"$@"
-	CC=${headers_only_CC} \
-	CFLAGS=${headers_only_CFLAGS} \
-	CPPFLAGS=${headers_only_CPPFLAGS} \
-	LDFLAGS="" \
-	"$@" || die "failed to configure glibc"
-}
-
-do_src_configure() {
-	if just_headers ; then
-		glibc_headers_configure
-	else
-		glibc_do_configure nptl
-	fi
-}
-
-src_configure() {
-	foreach_abi do_src_configure
-}
-
-# src_compile
-
-do_src_compile() {
-	emake -C "$(builddir nptl)"
-}
-
-src_compile() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi do_src_compile
-}
-
-# src_test
-
-glibc_src_test() {
-	cd "$(builddir nptl)"
-
-	local myxfailparams=""
-	if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
-		local virt=$(systemd-detect-virt 2>/dev/null)
-		if [[ ${virt} == systemd-nspawn ]] ; then
-			ewarn "Skipping extra tests because in systemd-nspawn container"
-			XFAIL_TEST_LIST+=( "${XFAIL_NSPAWN_TEST_LIST[@]}" )
-		fi
-		if [[ "$(nice)" == "19" ]] ; then
-			# Expects to be able to increase niceness, which it can't do if
-			# already at the highest nice value
-			XFAIL_TEST_LIST+=( "tst-nice" )
-		fi
-
-		for myt in ${XFAIL_TEST_LIST[@]} ; do
-			myxfailparams+="test-xfail-${myt}=yes "
-		done
-	fi
-
-	# sandbox does not understand unshare() and prevents
-	# writes to /proc/, which makes many tests fail
-
-	# 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
-}
-
-src_test() {
-	if just_headers ; then
-		return
-	fi
-
-	foreach_abi glibc_src_test || die "tests failed"
-}
-
-# src_install
-
-run_locale_gen() {
-	# if the host locales.gen contains no entries, we'll install everything
-	local root="$1"
-	local inplace=""
-
-	if [[ "${root}" == "--inplace-glibc" ]] ; then
-		inplace="--inplace-glibc"
-		root="$2"
-	fi
-
-	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"
-	fi
-
-	# bug 736794: we need to be careful with the parallelization... the number of
-	# processors saved in the environment of a binary package may differ strongly
-	# from the number of processes available during postinst
-	local mygenjobs="$(makeopts_jobs)"
-	if [[ "${EMERGE_FROM}" == "binary" ]] ; then
-		mygenjobs="$(nproc)"
-	fi
-
-	set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
-		--destdir "${root}"
-	echo "$@"
-	"$@"
-
-	popd >/dev/null
-}
-
-glibc_do_src_install() {
-	local builddir=$(builddir nptl)
-	cd "${builddir}"
-
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
-
-	# This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
-	# which come without headers etc. Only needed for binary packages since the
-	# external net-libs/libnsl has increased soversion. Keep only versioned libraries.
-	find "${D}" -name "libnsl.a" -delete
-	find "${D}" -name "libnsl.so" -delete
-
-	# Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
-	# to infer upstream version:
-	# '#define VERSION "2.26.90"' -> '2.26.90'
-	local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
-
-	# Avoid stripping binaries not targeted by ${CHOST}. Or else
-	# ${CHOST}-strip would break binaries build for ${CTARGET}.
-	is_crosscompile && dostrip -x /
-
-	# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
-	# See Note [Disable automatic stripping]
-	dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-	# valgrind requires knowledge about ld.so symbols.
-	dostrip -x $(alt_libdir)/ld-*.so*
-
-	if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
-		# Move versioned .a file out of libdir to evade portage QA checks
-		# instead of using gen_usr_ldscript(). We fix ldscript as:
-		# "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-		sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" \
-			"${ED}"/$(alt_usrlibdir)/libm.a || die
-		dodir $(alt_usrlibdir)/${P}
-		mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a \
-			"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
-	fi
-
-	# We configure toolchains for standalone prefix systems with a sysroot,
-	# which is prepended to paths in ld scripts, so strip the prefix from these.
-	# Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a  AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) )
-	# After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
-	if [[ -n $(host_eprefix) ]] ; then
-		local file
-		grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do
-			sed -i "s|$(host_eprefix)/|/|g" "${file}" || die
-		done
-	fi
-
-	# We'll take care of the cache ourselves
-	rm -f "${ED}"/etc/ld.so.cache
-
-	# Everything past this point just needs to be done once ...
-	is_final_abi || return 0
-
-	# Make sure the non-native interp can be found on multilib systems even
-	# if the main library set isn't installed into the right place.  Maybe
-	# we should query the active gcc for info instead of hardcoding it ?
-	local i ldso_abi ldso_name
-	local ldso_abi_list=(
-		# x86
-		amd64   /lib64/ld-linux-x86-64.so.2
-		x32     /libx32/ld-linux-x32.so.2
-		x86     /lib/ld-linux.so.2
-		# mips
-		o32     /lib/ld.so.1
-		n32     /lib32/ld.so.1
-		n64     /lib64/ld.so.1
-		# powerpc
-		ppc     /lib/ld.so.1
-		# riscv
-		ilp32d  /lib/ld-linux-riscv32-ilp32d.so.1
-		ilp32   /lib/ld-linux-riscv32-ilp32.so.1
-		lp64d   /lib/ld-linux-riscv64-lp64d.so.1
-		lp64    /lib/ld-linux-riscv64-lp64.so.1
-		# s390
-		s390    /lib/ld.so.1
-		s390x   /lib/ld64.so.1
-		# sparc
-		sparc32 /lib/ld-linux.so.2
-		sparc64 /lib64/ld-linux.so.2
-	)
-	case $(tc-endian) in
-	little)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64.so.1
-			# ELFv2 (glibc does not support ELFv1 on LE)
-			ppc64   /lib64/ld64.so.2
-		)
-		;;
-	big)
-		ldso_abi_list+=(
-			# arm
-			arm64   /lib/ld-linux-aarch64_be.so.1
-			# ELFv1 (glibc does not support ELFv2 on BE)
-			ppc64   /lib64/ld64.so.1
-		)
-		;;
-	esac
-	if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
-		dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
-	fi
-	for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
-		ldso_abi=${ldso_abi_list[i]}
-		has ${ldso_abi} $(get_install_abis) || continue
-
-		ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-		if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
-			dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
-		fi
-	done
-
-	# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
-	# the runtime loader name, see also https://xkcd.com/927/
-	# Normally, in Gentoo one should never come across executables that require this.
-	# However, binary commercial packages are known to adhere to weird practices.
-	# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
-	local lsb_ldso_name native_ldso_name lsb_ldso_abi
-	local lsb_ldso_abi_list=(
-		# x86
-		amd64	ld-linux-x86-64.so.2	ld-lsb-x86-64.so.3
-	)
-	for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
-		lsb_ldso_abi=${lsb_ldso_abi_list[i]}
-		native_ldso_name=${lsb_ldso_abi_list[i+1]}
-		lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
-		has ${lsb_ldso_abi} $(get_install_abis) || continue
-
-		if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
-			dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
-		fi
-	done
-
-	# With devpts under Linux mounted properly, we do not need the pt_chown
-	# binary to be setuid.  This is because the default owners/perms will be
-	# exactly what we want.
-	if ! use suid ; then
-		find "${ED}" -name pt_chown -exec chmod -s {} +
-	fi
-
-	#################################################################
-	# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
-	#################################################################
-
-	# Make sure we install some symlink hacks so that when we build
-	# a 2nd stage cross-compiler, gcc finds the target system
-	# headers correctly.  See gcc/doc/gccinstall.info
-	if is_crosscompile ; then
-		# We need to make sure that /lib and /usr/lib always exists.
-		# gcc likes to use relative paths to get to its multilibs like
-		# /usr/lib/../lib64/.  So while we don't install any files into
-		# /usr/lib/, we do need it to exist.
-		keepdir $(alt_prefix)/lib
-		keepdir $(alt_prefix)/usr/lib
-
-		dosym usr/include $(alt_prefix)/sys-include
-		return 0
-	fi
-
-	# Files for Debian-style locale updating
-	dodir /usr/share/i18n
-	sed \
-		-e "/^#/d" \
-		-e "/SUPPORTED-LOCALES=/d" \
-		-e "s: \\\\::g" -e "s:/: :g" \
-		"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
-		|| die "generating /usr/share/i18n/SUPPORTED failed"
-
-	cd "${S}" || die
-
-	# Install misc network config files
-	insinto /etc
-	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
-
-	if use nscd ; then
-		doins nscd/nscd.conf
-
-		newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
-
-		local nscd_args=(
-			-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
-		)
-
-		sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
-
-		use systemd && systemd_dounit nscd/nscd.service
-		newtmpfiles nscd/nscd.tmpfiles nscd.conf
-	fi
-
-	echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
-	doenvd "${T}"/00glibc
-
-	for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
-		[[ -s ${d} ]] && dodoc ${d}
-	done
-	dodoc -r ChangeLog.old
-
-	# Prevent overwriting of the /etc/localtime symlink.  We'll handle the
-	# creation of the "factory" symlink in pkg_postinst().
-	rm -f "${ED}"/etc/localtime
-
-	# Generate all locales if this is a native build as locale generation
-	if use compile-locales && ! is_crosscompile ; then
-		run_locale_gen --inplace-glibc "${ED}/"
-	fi
-}
-
-glibc_headers_install() {
-	local builddir=$(builddir "headers")
-	cd "${builddir}"
-	emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
-
-	insinto $(alt_headers)/gnu
-	doins "${S}"/include/gnu/stubs.h
-
-	# Make sure we install the sys-include symlink so that when
-	# we build a 2nd stage cross-compiler, gcc finds the target
-	# system headers correctly.  See gcc/doc/gccinstall.info
-	dosym usr/include $(alt_prefix)/sys-include
-}
-
-src_install() {
-	if just_headers ; then
-		export ABI=default
-		glibc_headers_install
-		return
-	fi
-
-	foreach_abi glibc_do_src_install
-
-	if ! use static-libs ; then
-		einfo "Not installing static glibc libraries"
-		find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-	fi
-}
-
-# Simple test to make sure our new glibc isn't completely broken.
-# Make sure we don't test with statically built binaries since
-# they will fail.  Also, skip if this glibc is a cross compiler.
-#
-# If coreutils is built with USE=multicall, some of these files
-# will just be wrapper scripts, not actual ELFs we can test.
-glibc_sanity_check() {
-	cd / #228809
-
-	# We enter ${ED} so to avoid trouble if the path contains
-	# special characters; for instance if the path contains the
-	# colon character (:), then the linker will try to split it
-	# and look for the libraries in an unexpected place. This can
-	# lead to unsafe code execution if the generated prefix is
-	# within a world-writable directory.
-	# (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})
-		[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
-		striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-		case ${striptest} in
-		*"statically linked"*) continue;;
-		*"ASCII text"*) continue;;
-		esac
-		# 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 \
-		${newldso} --library-path . ${x} > /dev/null \
-			|| die "simple run test (${x}) failed"
-	done
-
-	popd >/dev/null
-}
-
-pkg_preinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	einfo "Checking general environment sanity."
-	sanity_prechecks
-
-	# prepare /etc/ld.so.conf.d/ for files
-	mkdir -p "${EROOT}"/etc/ld.so.conf.d
-
-	# Default /etc/hosts.conf:multi to on for systems with small dbs.
-	if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
-		sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
-		einfo "Defaulting /etc/host.conf:multi to on"
-	fi
-
-	[[ -n ${ROOT} ]] && return 0
-	[[ -d ${ED}/$(get_libdir) ]] || return 0
-	[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
-
-	if [[ -L ${EROOT}/usr/lib/locale ]]; then
-		# Help portage migrate this to a directory
-		# 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 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
-}
-
-glibc_refresh_ldconfig() {
-	if [[ ${MERGE_TYPE} == buildonly ]]; then
-		return
-	fi
-
-	# Version check could be added to avoid unnecessary work, but ldconfig
-	# should finish quickly enough to not matter.
-	ebegin "Refreshing ld.so.cache"
-	ldconfig -i
-	if ! eend $?; then
-		ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
-		ewarn "before you manually do so (ldconfig -i)."
-	fi
-}
-
-pkg_postinst() {
-	# nothing to do if just installing headers
-	just_headers && return
-
-	if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
-		# Generate fastloading iconv module configuration file.
-		"${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
-	fi
-
-	if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-		# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
-		# handling has changed as well, which means stale ldconfig auxiliary
-		# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
-		# every C++ application) / libgomp etc., among other breakages.
-		#
-		# To fix this, simply refresh the ld.so.cache without using the
-		# auxiliary cache if we're natively installing on loong. This should
-		# be done relatively soon because we want to minimize the breakage
-		# window for the affected programs.
-		use loong && glibc_refresh_ldconfig
-
-		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 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"
-				ewarn "  sys-auth/libnss-nis"
-				ewarn "Install it now to keep your NIS setup working."
-				ewarn ""
-			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
-}


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-11-21 15:04 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-11-21 15:04 UTC (permalink / raw
  To: gentoo-commits

commit:     e967a1857d842a9d757da973413fdc097b339b2d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 21 15:03:37 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov 21 15:03:37 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e967a185

sys-libs/glibc: Stabilize 2.39-r11 hppa, #942687

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r11.ebuild b/sys-libs/glibc/glibc-2.39-r11.ebuild
index b621ff28fc03..4fe43aceef7a 100644
--- a/sys-libs/glibc/glibc-2.39-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r11.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-11-21 15:04 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-11-21 15:04 UTC (permalink / raw
  To: gentoo-commits

commit:     c8e6bb1acea8cca10f466494a9c37ca27577708d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 21 15:03:32 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov 21 15:03:32 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8e6bb1a

sys-libs/glibc: Stabilize 2.39-r11 arm, #942687

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r11.ebuild b/sys-libs/glibc/glibc-2.39-r11.ebuild
index d42b4f42bc0c..b621ff28fc03 100644
--- a/sys-libs/glibc/glibc-2.39-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r11.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-11-21 15:04 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-11-21 15:04 UTC (permalink / raw
  To: gentoo-commits

commit:     0e7cb4db6e6ee98b3be6c2384e78e4c71ae41d91
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 21 15:03:41 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov 21 15:03:41 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0e7cb4db

sys-libs/glibc: Stabilize 2.39-r11 sparc, #942687

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r11.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.39-r11.ebuild b/sys-libs/glibc/glibc-2.39-r11.ebuild
index 4fe43aceef7a..4b46bc6f4e34 100644
--- a/sys-libs/glibc/glibc-2.39-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r11.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-11-21 15:04 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-11-21 15:04 UTC (permalink / raw
  To: gentoo-commits

commit:     f23f965723e5e7952788f03c6b791b579350bb7a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 21 15:03:33 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov 21 15:03:33 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f23f9657

sys-libs/glibc: Stabilize 2.40-r5 arm, #942687

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.40-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.40-r5.ebuild b/sys-libs/glibc/glibc-2.40-r5.ebuild
index 01aac3024740..482323623ce6 100644
--- a/sys-libs/glibc/glibc-2.40-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.40-r5.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-11-21 15:04 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-11-21 15:04 UTC (permalink / raw
  To: gentoo-commits

commit:     f177e0809545e4848fa2bfe991672b6a992d2393
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 21 15:03:38 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov 21 15:03:38 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f177e080

sys-libs/glibc: Stabilize 2.40-r5 hppa, #942687

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.40-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.40-r5.ebuild b/sys-libs/glibc/glibc-2.40-r5.ebuild
index 482323623ce6..dcdad08aa40b 100644
--- a/sys-libs/glibc/glibc-2.40-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.40-r5.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
@ 2024-11-21 15:04 Sam James
  0 siblings, 0 replies; 1076+ messages in thread
From: Sam James @ 2024-11-21 15:04 UTC (permalink / raw
  To: gentoo-commits

commit:     06f37e3d6201c945caa2612148c523294a148783
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 21 15:03:42 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov 21 15:03:42 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06f37e3d

sys-libs/glibc: Stabilize 2.40-r5 sparc, #942687

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.40-r5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-libs/glibc/glibc-2.40-r5.ebuild b/sys-libs/glibc/glibc-2.40-r5.ebuild
index dcdad08aa40b..3cfc6b632960 100644
--- a/sys-libs/glibc/glibc-2.40-r5.ebuild
+++ b/sys-libs/glibc/glibc-2.40-r5.ebuild
@@ -41,7 +41,7 @@ HOMEPAGE="https://www.gnu.org/software/libc/"
 if [[ ${PV} == 9999* ]]; then
 	inherit git-r3
 else
-	KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
 	SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 	SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
 fi


^ permalink raw reply related	[flat|nested] 1076+ messages in thread

end of thread, other threads:[~2024-11-21 15:04 UTC | newest]

Thread overview: 1076+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-08 20:43 [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/ Sergei Trofimovich
  -- strict thread matches above, loose matches on Subject: below --
2024-11-21 15:04 Sam James
2024-11-21 15:04 Sam James
2024-11-21 15:04 Sam James
2024-11-21 15:04 Sam James
2024-11-21 15:04 Sam James
2024-11-21 15:04 Sam James
2024-11-03 17:27 Andreas K. Hüttel
2024-11-03  4:40 Sam James
2024-11-03  4:40 Sam James
2024-11-02 11:23 Arthur Zamarin
2024-11-02 11:23 Arthur Zamarin
2024-11-02  8:49 Michał Górny
2024-11-02  8:49 Michał Górny
2024-11-02  3:47 Sam James
2024-11-02  3:47 Sam James
2024-11-02  3:23 Sam James
2024-11-02  3:23 Sam James
2024-10-10  7:11 Andreas K. Hüttel
2024-10-10  1:13 Andreas K. Hüttel
2024-10-09  9:16 Andreas K. Hüttel
2024-10-09  6:57 Andreas K. Hüttel
2024-10-09  6:57 Andreas K. Hüttel
2024-10-07 15:56 Sam James
2024-10-03 16:43 Andreas K. Hüttel
2024-10-03 12:35 Andreas K. Hüttel
2024-10-03  9:29 Andreas K. Hüttel
2024-10-01 16:23 Andreas K. Hüttel
2024-10-01 16:23 Andreas K. Hüttel
2024-09-12 22:08 Sam James
2024-09-12 10:47 Andreas K. Hüttel
2024-09-11 23:56 Andreas K. Hüttel
2024-09-10 10:01 Andreas K. Hüttel
2024-09-09 10:59 Andreas K. Hüttel
2024-08-31  0:33 Sam James
2024-08-26 16:33 Sam James
2024-07-28  3:35 Sam James
2024-07-27 15:42 Sam James
2024-07-22 20:46 Andreas K. Hüttel
2024-07-22 15:37 Andreas K. Hüttel
2024-06-28 18:05 Sam James
2024-06-26 14:59 Mike Gilbert
2024-06-24  1:28 Sam James
2024-06-14 12:46 Andreas K. Hüttel
2024-06-13 13:56 Andreas K. Hüttel
2024-06-12 23:29 Sam James
2024-06-12 23:29 Sam James
2024-06-12 23:16 Andreas K. Hüttel
2024-06-11 20:16 Andreas K. Hüttel
2024-05-30 12:00 Andreas K. Hüttel
2024-05-29 22:46 Andreas K. Hüttel
2024-05-25 19:03 Arthur Zamarin
2024-05-25 19:03 Arthur Zamarin
2024-05-19 17:37 Arthur Zamarin
2024-05-17 18:26 Sam James
2024-05-17 16:01 Sam James
2024-05-17 14:59 Arthur Zamarin
2024-05-17 14:59 Arthur Zamarin
2024-05-14 14:36 Andreas K. Hüttel
2024-05-12 14:28 Andreas K. Hüttel
2024-05-12 10:26 Andreas K. Hüttel
2024-05-11  1:42 Sam James
2024-05-06  5:28 Sam James
2024-05-05  1:14 Andreas K. Hüttel
2024-05-04 14:10 Andreas K. Hüttel
2024-05-04 13:59 Andreas K. Hüttel
2024-05-04 13:58 Andreas K. Hüttel
2024-05-04 12:00 Sam James
2024-05-04 12:00 Sam James
2024-05-01 23:48 Andreas K. Hüttel
2024-05-01 23:18 Ionen Wolkens
2024-05-01 23:18 Ionen Wolkens
2024-04-30  5:54 Sam James
2024-04-26 19:36 Sam James
2024-04-26 18:46 Arthur Zamarin
2024-04-26 18:40 Arthur Zamarin
2024-04-26 18:37 Arthur Zamarin
2024-04-26 18:16 Sam James
2024-04-26 13:42 Andreas K. Hüttel
2024-04-26 10:02 Andreas K. Hüttel
2024-04-24 15:02 Sam James
2024-04-23 14:40 Sam James
2024-04-20 18:08 Arthur Zamarin
2024-04-20 18:08 Arthur Zamarin
2024-04-20  9:42 Michał Górny
2024-04-20  9:42 Michał Górny
2024-04-20  9:42 Michał Górny
2024-04-19 10:47 Andreas K. Hüttel
2024-04-18  2:42 Sam James
2024-04-18  2:42 Sam James
2024-04-18  0:39 Andreas K. Hüttel
2024-04-13 18:41 Sam James
2024-04-13 18:41 Sam James
2024-04-06  6:51 Arthur Zamarin
2024-04-06  6:51 Arthur Zamarin
2024-04-06  6:51 Arthur Zamarin
2024-04-06  6:51 Arthur Zamarin
2024-03-22  4:14 Sam James
2024-03-18 14:59 Sam James
2024-03-11 19:20 Sam James
2024-03-03 17:17 Andreas K. Hüttel
2024-03-03  2:00 Andreas K. Hüttel
2024-02-24 20:45 Andreas K. Hüttel
2024-02-23 23:07 Andreas K. Hüttel
2024-02-23 12:13 Andreas K. Hüttel
2024-02-23  7:14 Sam James
2024-02-19 16:59 Andreas K. Hüttel
2024-02-19  5:44 Andreas K. Hüttel
2024-02-05 23:09 Andreas K. Hüttel
2024-02-05 23:09 Andreas K. Hüttel
2024-02-02  2:34 Sam James
2024-02-02  2:34 Sam James
2024-02-02  2:34 Sam James
2024-02-02  2:34 Sam James
2024-02-02  2:34 Sam James
2024-01-31 23:23 Andreas K. Hüttel
2024-01-31 22:08 Sam James
2024-01-31 22:05 Sam James
2024-01-31 22:05 Sam James
2024-01-31 22:02 Andreas K. Hüttel
2024-01-31 16:35 Andreas K. Hüttel
2024-01-31  1:36 Andreas K. Hüttel
2024-01-30 19:16 Andreas K. Hüttel
2024-01-23 18:28 Andreas K. Hüttel
2024-01-23 18:13 Andreas K. Hüttel
2024-01-11 18:55 Andreas K. Hüttel
2024-01-11  0:05 Andreas K. Hüttel
2024-01-09 15:21 Andreas K. Hüttel
2024-01-09  2:57 Sam James
2024-01-07 14:25 Arthur Zamarin
2024-01-07 14:25 Arthur Zamarin
2024-01-07 12:43 Arthur Zamarin
2024-01-07 12:43 Arthur Zamarin
2024-01-07 12:43 Arthur Zamarin
2024-01-07 12:43 Arthur Zamarin
2024-01-07 12:43 Arthur Zamarin
2024-01-07 12:43 Arthur Zamarin
2024-01-07 12:42 Arthur Zamarin
2024-01-07 12:42 Arthur Zamarin
2024-01-07 12:42 Arthur Zamarin
2024-01-07 12:42 Arthur Zamarin
2024-01-07  9:53 Sam James
2024-01-07  9:53 Sam James
2024-01-03 21:56 Sam James
2024-01-03 21:54 Sam James
2023-12-25 20:03 Andreas K. Hüttel
2023-12-25 20:03 Andreas K. Hüttel
2023-12-23 22:03 Andreas K. Hüttel
2023-12-23 18:22 Sam James
2023-12-23 17:09 Andreas K. Hüttel
2023-10-28 15:47 Andreas K. Hüttel
2023-10-28 15:47 Andreas K. Hüttel
2023-10-27 20:12 Andreas K. Hüttel
2023-10-26 20:49 Andreas K. Hüttel
2023-10-19  8:14 Andreas K. Hüttel
2023-10-19  8:12 Andreas K. Hüttel
2023-10-18 19:13 Andreas K. Hüttel
2023-10-18 19:13 Andreas K. Hüttel
2023-10-18 19:13 Andreas K. Hüttel
2023-10-18 10:02 Sam James
2023-10-15 15:23 Sam James
2023-10-13 15:11 Sam James
2023-10-04 18:32 Arthur Zamarin
2023-10-03 23:07 Sam James
2023-10-03 23:04 Sam James
2023-10-03 22:28 Andreas K. Hüttel
2023-10-03 22:15 Sam James
2023-10-03 21:45 Sam James
2023-10-03 21:41 Sam James
2023-10-03 21:13 Andreas K. Hüttel
2023-10-03 18:11 Andreas K. Hüttel
2023-10-03 18:06 Andreas K. Hüttel
2023-09-29 22:07 Andreas K. Hüttel
2023-09-29 22:07 Andreas K. Hüttel
2023-09-29 20:10 Andreas K. Hüttel
2023-09-29  9:26 Andreas K. Hüttel
2023-09-29  8:20 Andreas K. Hüttel
2023-09-28  9:27 Andreas K. Hüttel
2023-09-19 18:10 Sam James
2023-09-18  9:55 WANG Xuerui
2023-09-17 21:28 Andreas K. Hüttel
2023-09-17 11:58 Andreas K. Hüttel
2023-09-16  9:40 Andreas K. Hüttel
2023-09-13 15:03 James Le Cuirot
2023-08-24 14:57 Sam James
2023-08-24 11:23 Andreas K. Hüttel
2023-08-23 22:46 Andreas K. Hüttel
2023-08-23 12:30 Andreas K. Hüttel
2023-08-17  4:48 Sam James
2023-08-17  4:48 Sam James
2023-08-02 22:58 Sam James
2023-08-02 21:55 Sam James
2023-07-31 21:42 Andreas K. Hüttel
2023-07-29 23:43 Andreas K. Hüttel
2023-07-29 12:22 Andreas K. Hüttel
2023-07-24 22:45 Sam James
2023-07-24 22:44 Sam James
2023-07-24 22:32 Andreas K. Hüttel
2023-07-24 22:19 Andreas K. Hüttel
2023-07-17 20:28 Andreas K. Hüttel
2023-07-15 12:12 Arthur Zamarin
2023-07-15 12:12 Arthur Zamarin
2023-07-15 12:12 Arthur Zamarin
2023-07-13 10:08 Sam James
2023-07-09 19:07 Arthur Zamarin
2023-07-09 19:07 Arthur Zamarin
2023-07-09 19:07 Arthur Zamarin
2023-07-04 11:18 Andreas K. Hüttel
2023-07-02 14:57 Sam James
2023-06-30 18:28 Andreas K. Hüttel
2023-06-28 21:23 Sam James
2023-06-26 15:32 Sam James
2023-06-26 11:28 Sam James
2023-06-26 11:28 Sam James
2023-06-26 11:28 Sam James
2023-06-26 11:28 Sam James
2023-06-26 11:28 Sam James
2023-06-26 11:28 Sam James
2023-05-16 20:02 Sam James
2023-05-12  1:14 Sam James
2023-05-10 19:15 Andreas K. Hüttel
2023-05-09 20:59 Andreas K. Hüttel
2023-05-08 21:29 Andreas K. Hüttel
2023-05-07 21:51 Andreas K. Hüttel
2023-05-07 21:31 Andreas K. Hüttel
2023-05-07 16:03 Sam James
2023-05-07  0:02 Andreas K. Hüttel
2023-05-06 22:46 Andreas K. Hüttel
2023-05-06 22:29 Andreas K. Hüttel
2023-05-06 22:21 Andreas K. Hüttel
2023-05-01 14:07 Sam James
2023-04-22 21:14 Andreas K. Hüttel
2023-04-13 22:58 Andreas K. Hüttel
2023-04-11  3:21 Andreas K. Hüttel
2023-04-02 19:30 Arthur Zamarin
2023-04-02 19:30 Arthur Zamarin
2023-04-01 16:34 Arthur Zamarin
2023-04-01 16:34 Arthur Zamarin
2023-04-01 16:34 Arthur Zamarin
2023-04-01 16:34 Arthur Zamarin
2023-03-21 17:47 Andreas K. Hüttel
2023-03-21 17:44 Andreas K. Hüttel
2023-03-21 17:42 Andreas K. Hüttel
2023-03-17  2:37 Sam James
2023-03-11 14:11 Andreas K. Hüttel
2023-03-10  8:08 Sam James
2023-03-10  8:08 Sam James
2023-03-10  7:25 Sam James
2023-02-28  3:33 Sam James
2023-02-25 15:52 Andreas K. Hüttel
2023-02-08 14:59 Andreas K. Hüttel
2023-02-02 15:34 Andreas K. Hüttel
2023-01-30 19:45 James Le Cuirot
2023-01-26 22:06 Andreas K. Hüttel
2023-01-26 21:57 Andreas K. Hüttel
2023-01-21 19:51 Andreas K. Hüttel
2023-01-21  0:46 Andreas K. Hüttel
2023-01-20 23:59 Andreas K. Hüttel
2023-01-10 22:47 James Le Cuirot
2022-12-05 23:17 Andreas K. Hüttel
2022-12-02 19:39 Arthur Zamarin
2022-12-02 19:39 Arthur Zamarin
2022-11-27 16:23 Andreas K. Hüttel
2022-11-19 19:03 Andreas K. Hüttel
2022-11-19 16:09 Arthur Zamarin
2022-11-19 16:09 Arthur Zamarin
2022-11-19 16:09 Arthur Zamarin
2022-11-19 16:09 Arthur Zamarin
2022-11-18 18:01 Arthur Zamarin
2022-11-18 18:01 Arthur Zamarin
2022-11-18 15:42 Arthur Zamarin
2022-11-18 15:42 Arthur Zamarin
2022-11-18 15:42 Arthur Zamarin
2022-11-18 15:42 Arthur Zamarin
2022-11-16 19:22 Sam James
2022-11-16 19:22 Sam James
2022-11-15 20:09 Michał Górny
2022-11-15 14:51 Arthur Zamarin
2022-11-15 14:51 Arthur Zamarin
2022-11-06 19:38 Andreas K. Hüttel
2022-10-16  8:50 Andreas K. Hüttel
2022-10-15 23:23 Andreas K. Hüttel
2022-10-15 19:42 Andreas K. Hüttel
2022-10-15 19:42 Andreas K. Hüttel
2022-10-02  8:40 Andreas K. Hüttel
2022-10-01 20:56 Andreas K. Hüttel
2022-09-25  1:21 Sam James
2022-09-23 20:25 Andreas K. Hüttel
2022-09-23 20:07 Andreas K. Hüttel
2022-09-23 20:00 Andreas K. Hüttel
2022-09-23 15:31 Andreas K. Hüttel
2022-09-23 15:30 Andreas K. Hüttel
2022-09-22  6:45 Andreas K. Hüttel
2022-09-20 20:20 Andreas K. Hüttel
2022-09-20 14:46 Sam James
2022-09-20  6:37 Andreas K. Hüttel
2022-09-18 15:51 Andreas K. Hüttel
2022-09-09 20:32 Andreas K. Hüttel
2022-09-03 20:38 Andreas K. Hüttel
2022-08-27 19:36 Andreas K. Hüttel
2022-08-27 18:05 Arthur Zamarin
2022-08-20  0:59 Sam James
2022-08-20  0:32 Sam James
2022-08-07  8:02 WANG Xuerui
2022-08-02 21:12 Andreas K. Hüttel
2022-08-01  8:05 Agostino Sarubbo
2022-07-31 11:11 Agostino Sarubbo
2022-07-31 11:10 Agostino Sarubbo
2022-07-31 11:09 Agostino Sarubbo
2022-07-31 11:08 Agostino Sarubbo
2022-07-31 11:06 Agostino Sarubbo
2022-07-30 23:46 Sam James
2022-07-28 23:40 Andreas K. Hüttel
2022-07-06  3:07 Andreas K. Hüttel
2022-07-05  4:12 Andreas K. Hüttel
2022-06-25 21:40 Sam James
2022-06-25 21:40 Sam James
2022-06-25 21:40 Sam James
2022-06-08 22:30 Sam James
2022-06-08 10:42 Michał Górny
2022-06-06 18:01 Andreas K. Hüttel
2022-06-06 16:04 Andreas K. Hüttel
2022-06-05 22:07 Andreas K. Hüttel
2022-05-25  0:09 WANG Xuerui
2022-05-18 10:02 Andreas K. Hüttel
2022-05-17 21:18 Andreas K. Hüttel
2022-05-15 17:02 Andreas K. Hüttel
2022-05-15  1:00 Sam James
2022-05-14  9:30 Arthur Zamarin
2022-05-14  9:30 Arthur Zamarin
2022-05-14  1:52 Sam James
2022-05-13 18:36 Sam James
2022-05-13  8:53 Agostino Sarubbo
2022-05-10  9:54 Agostino Sarubbo
2022-05-05  7:45 Arthur Zamarin
2022-05-05  7:45 Arthur Zamarin
2022-05-05  7:33 Arthur Zamarin
2022-05-04 14:40 Sam James
2022-04-26  8:55 Andreas K. Hüttel
2022-04-25 21:21 Andreas K. Hüttel
2022-04-25 21:21 Andreas K. Hüttel
2022-04-24 23:33 Sam James
2022-04-23 23:54 Sam James
2022-04-22 15:13 Andreas K. Hüttel
2022-04-22 10:46 Andreas K. Hüttel
2022-04-20 22:25 Andreas K. Hüttel
2022-04-19 22:09 Sam James
2022-04-10 10:54 Sam James
2022-04-07 19:53 Sam James
2022-04-02  7:33 Arthur Zamarin
2022-04-01  9:29 Arthur Zamarin
2022-04-01  6:39 Arthur Zamarin
2022-03-31 21:17 Arthur Zamarin
2022-03-31 20:54 Andreas K. Hüttel
2022-03-31 19:02 Andreas K. Hüttel
2022-03-30 23:19 Andreas K. Hüttel
2022-03-27 23:26 Sam James
2022-03-27 20:30 Andreas K. Hüttel
2022-03-27 17:06 Arthur Zamarin
2022-03-27 16:14 Andreas K. Hüttel
2022-03-27 16:09 Andreas K. Hüttel
2022-03-27 14:06 Andreas K. Hüttel
2022-03-26 21:40 Sam James
2022-03-26 21:40 Sam James
2022-03-26 20:51 Andreas K. Hüttel
2022-03-26 19:45 Sam James
2022-03-26 19:45 Sam James
2022-03-26 19:45 Sam James
2022-03-26 19:45 Sam James
2022-03-22 16:58 Andreas K. Hüttel
2022-03-21 23:33 Sam James
2022-03-20 21:14 Sam James
2022-03-20 21:14 Sam James
2022-03-08 14:57 Andreas K. Hüttel
2022-03-07  1:09 Andreas K. Hüttel
2022-03-07  1:09 Andreas K. Hüttel
2022-03-06  9:46 Sam James
2022-03-06  9:46 Sam James
2022-03-06  9:46 Sam James
2022-02-23 20:00 Arthur Zamarin
2022-02-23  0:15 Andreas K. Hüttel
2022-02-21 23:30 Andreas K. Hüttel
2022-02-21 22:38 Andreas K. Hüttel
2022-02-12  0:06 Andreas K. Hüttel
2022-02-11 22:44 Andreas K. Hüttel
2022-02-11  0:33 Andreas K. Hüttel
2022-02-07  2:52 Sam James
2022-02-07  2:46 Sam James
2022-02-06  2:13 Andreas K. Hüttel
2022-02-06  1:41 Andreas K. Hüttel
2022-02-05 12:43 Andreas K. Hüttel
2022-02-05 12:43 Andreas K. Hüttel
2022-02-05 12:43 Andreas K. Hüttel
2022-02-05 12:43 Andreas K. Hüttel
2022-02-03 23:49 Andreas K. Hüttel
2022-02-02  0:18 Andreas K. Hüttel
2022-02-01 20:36 Andreas K. Hüttel
2022-01-31 23:03 Andreas K. Hüttel
2022-01-29 17:49 Andreas K. Hüttel
2022-01-29 16:07 Andreas K. Hüttel
2022-01-28 22:34 Andreas K. Hüttel
2022-01-27 14:13 Andreas K. Hüttel
2022-01-25 21:27 Andreas K. Hüttel
2022-01-25 16:10 Andreas K. Hüttel
2022-01-25 13:13 Andreas K. Hüttel
2022-01-24 19:54 Andreas K. Hüttel
2022-01-24 19:53 Andreas K. Hüttel
2022-01-18 22:12 Andreas K. Hüttel
2022-01-15 19:36 Andreas K. Hüttel
2022-01-12 23:00 Andreas K. Hüttel
2022-01-05 21:16 Andreas K. Hüttel
2022-01-05 21:15 Andreas K. Hüttel
2022-01-05  5:24 Sam James
2022-01-04 11:49 Andreas K. Hüttel
2021-12-29 19:31 Andreas K. Hüttel
2021-12-19 11:40 Andreas K. Hüttel
2021-12-19 11:40 Andreas K. Hüttel
2021-12-18 21:58 Sam James
2021-12-18 21:51 Andreas K. Hüttel
2021-12-09 20:55 Andreas K. Hüttel
2021-12-09  6:37 Sam James
2021-12-05 20:32 Andreas K. Hüttel
2021-12-05 15:32 Andreas K. Hüttel
2021-12-05 10:26 Andreas K. Hüttel
2021-12-01 14:53 Sam James
2021-11-29 10:13 Andreas K. Hüttel
2021-11-27 23:47 Sam James
2021-11-26 19:42 Andreas K. Hüttel
2021-11-26 18:52 Mike Frysinger
2021-11-16 23:33 Jason A. Donenfeld
2021-11-15 16:13 Mike Gilbert
2021-11-14 23:05 Sam James
2021-11-13 21:35 Andreas K. Hüttel
2021-11-11 21:04 Sam James
2021-11-07 22:58 Andreas K. Hüttel
2021-11-07 22:58 Andreas K. Hüttel
2021-11-06  2:35 Sam James
2021-11-06  0:52 Sam James
2021-11-03 17:27 Sam James
2021-11-03  0:54 Sam James
2021-10-31 19:18 Sam James
2021-10-31 18:12 Sam James
2021-10-31 18:12 Sam James
2021-10-31 18:12 Sam James
2021-10-31 18:10 Sam James
2021-10-31 18:10 Sam James
2021-10-31 18:10 Sam James
2021-10-30 15:50 Andreas K. Hüttel
2021-10-30 15:42 Andreas K. Hüttel
2021-10-29 17:07 Andreas K. Hüttel
2021-10-01  7:14 Sam James
2021-09-25 19:21 Andreas K. Hüttel
2021-09-08 23:48 Sam James
2021-09-05  5:48 Sam James
2021-09-02 15:26 Andreas K. Hüttel
2021-08-30 17:37 Sam James
2021-08-18 18:01 Andreas K. Hüttel
2021-08-18 18:01 Andreas K. Hüttel
2021-08-18 18:01 Andreas K. Hüttel
2021-08-06 21:26 Andreas K. Hüttel
2021-08-03 15:23 Andreas K. Hüttel
2021-08-03 15:14 Andreas K. Hüttel
2021-08-02 23:10 Andreas K. Hüttel
2021-07-29 16:51 Andreas K. Hüttel
2021-07-27 20:33 Andreas K. Hüttel
2021-07-27 20:27 Andreas K. Hüttel
2021-07-27 20:27 Andreas K. Hüttel
2021-07-27 20:27 Andreas K. Hüttel
2021-07-25 21:54 Andreas K. Hüttel
2021-07-24 14:03 Andreas K. Hüttel
2021-07-24 13:12 Andreas K. Hüttel
2021-07-23 20:31 Andreas K. Hüttel
2021-07-23 12:28 Andreas K. Hüttel
2021-07-22 20:00 Andreas K. Hüttel
2021-07-17 23:33 Andreas K. Hüttel
2021-07-17 23:33 Andreas K. Hüttel
2021-07-17 17:12 Andreas K. Hüttel
2021-07-14 20:46 Andreas K. Hüttel
2021-07-09  4:23 Sam James
2021-07-09  4:23 Sam James
2021-07-08 19:26 Georgy Yakovlev
2021-07-05  6:59 Agostino Sarubbo
2021-07-05  6:06 Sergei Trofimovich
2021-07-05  3:25 Sam James
2021-07-04 10:29 Sergei Trofimovich
2021-06-17  8:15 Sergei Trofimovich
2021-06-13 13:47 Andreas K. Hüttel
2021-06-13 10:46 Sergei Trofimovich
2021-06-12 11:39 Sergei Trofimovich
2021-06-11 18:31 Andreas K. Hüttel
2021-06-11 17:18 Andreas K. Hüttel
2021-06-08  7:19 Sergei Trofimovich
2021-06-08  7:19 Sergei Trofimovich
2021-06-06  8:57 Sergei Trofimovich
2021-06-01 19:58 Sam James
2021-06-01 19:58 Sam James
2021-06-01 17:58 Sam James
2021-06-01 17:58 Sam James
2021-06-01 17:58 Sam James
2021-06-01 17:58 Sam James
2021-06-01 17:58 Sam James
2021-06-01 17:58 Sam James
2021-06-01 13:58 Sam James
2021-06-01 13:58 Sam James
2021-06-01 13:56 Sam James
2021-06-01 13:56 Sam James
2021-05-15 18:43 Georgy Yakovlev
2021-05-15 18:43 Georgy Yakovlev
2021-05-15 18:10 Sergei Trofimovich
2021-05-11 17:04 Sergei Trofimovich
2021-05-10  7:22 Sergei Trofimovich
2021-04-03  9:29 Andreas K. Hüttel
2021-04-02 11:56 Andreas K. Hüttel
2021-03-26 15:06 Agostino Sarubbo
2021-03-09 12:06 Sam James
2021-03-07 11:58 David Seifert
2021-03-03 21:32 Sam James
2021-02-28 21:33 Sam James
2021-02-28 16:00 Sam James
2021-02-28 15:57 Sam James
2021-02-28 11:08 Sergei Trofimovich
2021-02-27 20:50 Andreas K. Hüttel
2021-02-27 20:31 Andreas K. Hüttel
2021-02-27 19:18 Andreas K. Hüttel
2021-02-25 18:17 Andreas K. Hüttel
2021-02-24 22:50 Sam James
2021-02-15  0:38 Sam James
2021-02-11  7:49 Sergei Trofimovich
2021-02-06 18:27 Sergei Trofimovich
2021-02-05 21:44 Sam James
2021-02-05 21:43 Sam James
2021-02-05 21:42 Sam James
2021-02-05 21:39 Sam James
2021-02-03 10:35 Sergei Trofimovich
2021-02-01 21:17 Andreas K. Hüttel
2021-01-24 12:33 Sergei Trofimovich
2021-01-24 12:10 Agostino Sarubbo
2021-01-12 22:41 Sam James
2021-01-12 22:41 Sam James
2021-01-12 22:38 Sam James
2021-01-09 18:00 Sam James
2021-01-09 16:30 Sam James
2021-01-09 16:22 Lars Wendler
2021-01-09 13:12 Sergei Trofimovich
2021-01-07 11:24 Andreas K. Hüttel
2020-12-24  8:05 Sergei Trofimovich
2020-12-23  5:19 Sam James
2020-12-23  5:19 Sam James
2020-12-23  5:19 Sam James
2020-12-14  8:03 Sam James
2020-12-14  0:46 Sam James
2020-12-14  0:46 Sam James
2020-12-13 21:45 Thomas Deutschmann
2020-12-13  7:42 Sam James
2020-12-11  9:09 Sergei Trofimovich
2020-12-08 18:07 Sergei Trofimovich
2020-12-08 14:46 Andreas K. Hüttel
2020-12-08  8:30 Sergei Trofimovich
2020-12-08  8:30 Sergei Trofimovich
2020-12-08  8:30 Sergei Trofimovich
2020-12-08  0:37 Sergei Trofimovich
2020-11-14  9:15 Mikle Kolyada
2020-11-14  9:15 Mikle Kolyada
2020-11-10 19:16 Mike Gilbert
2020-11-05 16:48 Sam James
2020-11-05 16:48 Sam James
2020-11-05 16:48 Sam James
2020-11-05 16:48 Sam James
2020-11-01 10:40 Sam James
2020-11-01 10:40 Sam James
2020-11-01 10:40 Sam James
2020-11-01 10:40 Sam James
2020-10-31 11:07 Mikle Kolyada
2020-10-31 10:09 Andreas K. Hüttel
2020-10-30 22:32 Thomas Deutschmann
2020-10-30 21:45 Andreas K. Hüttel
2020-10-09 20:40 Andreas K. Hüttel
2020-09-30 18:13 Sergei Trofimovich
2020-09-25 19:42 Andreas K. Hüttel
2020-09-25 18:54 Andreas K. Hüttel
2020-09-25 18:54 Andreas K. Hüttel
2020-09-15 22:15 Sergei Trofimovich
2020-09-06  4:11 Sam James
2020-09-06  4:11 Sam James
2020-09-05  2:46 Andreas K. Hüttel
2020-09-05  2:46 Andreas K. Hüttel
2020-09-01 22:26 Andreas K. Hüttel
2020-08-31  8:30 Andreas K. Hüttel
2020-08-23 11:33 Sergei Trofimovich
2020-08-23 10:47 Sergei Trofimovich
2020-08-23 10:19 Sergei Trofimovich
2020-08-23 10:19 Sergei Trofimovich
2020-08-14  8:08 Andreas K. Hüttel
2020-08-12  7:38 Sam James
2020-08-12  7:38 Sam James
2020-08-11 22:29 Sam James
2020-08-11 17:02 Sergei Trofimovich
2020-08-11 17:02 Sergei Trofimovich
2020-08-10 16:43 Mikle Kolyada
2020-08-06 10:28 Andreas K. Hüttel
2020-08-04 15:11 Sam James
2020-08-03 17:58 Sam James
2020-07-27 15:41 Andreas K. Hüttel
2020-07-25 22:11 Andreas K. Hüttel
2020-07-18 16:58 Sergei Trofimovich
2020-07-18 15:59 Andreas K. Hüttel
2020-06-28 22:13 Sergei Trofimovich
2020-06-10  9:16 Andreas K. Hüttel
2020-06-10  9:16 Andreas K. Hüttel
2020-06-10  8:17 Sergei Trofimovich
2020-06-10  8:15 Andreas K. Hüttel
2020-06-09  7:24 Sergei Trofimovich
2020-06-08 22:04 Sergei Trofimovich
2020-05-16 11:30 Sergei Trofimovich
2020-05-16  8:58 Sergei Trofimovich
2020-05-15 23:12 Sergei Trofimovich
2020-05-14 11:48 Andreas K. Hüttel
2020-05-12 16:45 Andreas K. Hüttel
2020-05-12  5:05 Andreas K. Hüttel
2020-05-11 20:53 Sergei Trofimovich
2020-05-06  7:01 Sergei Trofimovich
2020-05-04 18:32 Andreas K. Hüttel
2020-05-04 18:23 Sergei Trofimovich
2020-05-04 18:23 Sergei Trofimovich
2020-05-04  6:16 Mart Raudsepp
2020-05-03 11:01 Sergei Trofimovich
2020-05-02 20:08 Sergei Trofimovich
2020-05-02 19:51 Sergei Trofimovich
2020-04-24 12:11 Agostino Sarubbo
2020-04-24 12:11 Agostino Sarubbo
2020-04-24 12:10 Agostino Sarubbo
2020-04-24  9:00 Agostino Sarubbo
2020-04-24  8:59 Agostino Sarubbo
2020-04-24  8:59 Agostino Sarubbo
2020-04-23 20:39 Andreas K. Hüttel
2020-04-23 20:39 Andreas K. Hüttel
2020-04-23 19:33 Andreas K. Hüttel
2020-04-23  9:02 Mikle Kolyada
2020-04-23  7:45 Andreas K. Hüttel
2020-04-13 17:25 Andreas K. Hüttel
2020-04-10 16:06 Andreas K. Hüttel
2020-04-10 16:06 Andreas K. Hüttel
2020-04-03 22:37 Sergei Trofimovich
2020-04-03 22:29 Sergei Trofimovich
2020-04-02  7:03 Sergei Trofimovich
2020-04-01 17:32 Matt Turner
2020-03-28  0:29 Sergei Trofimovich
2020-03-26  4:37 Matt Turner
2020-03-23 21:11 Andreas K. Hüttel
2020-03-22 19:43 Andreas K. Hüttel
2020-03-22 17:48 Andreas K. Hüttel
2020-03-22 14:54 Andreas K. Hüttel
2020-03-22 10:39 Andreas K. Hüttel
2020-03-22 10:39 Andreas K. Hüttel
2020-03-21 23:17 Andreas K. Hüttel
2020-03-20 15:30 Andreas K. Hüttel
2020-03-19 20:58 Andreas K. Hüttel
2020-03-16 21:23 Sergei Trofimovich
2020-03-15 15:46 Sergei Trofimovich
2020-03-15 13:50 Sergei Trofimovich
2020-03-15 12:47 Mikle Kolyada
2020-03-14 18:16 Sergei Trofimovich
2020-03-14  9:54 Sergei Trofimovich
2020-03-14  9:54 Sergei Trofimovich
2020-03-12 16:27 Andreas K. Hüttel
2020-03-10  7:35 Sergei Trofimovich
2020-03-09 10:07 Andreas K. Hüttel
2020-02-16 19:25 Sergei Trofimovich
2020-02-16 14:00 Sergei Trofimovich
2020-02-13 21:40 David Seifert
2020-02-03 23:07 Sergei Trofimovich
2020-02-02 13:04 Sergei Trofimovich
2020-01-12 22:36 Sergei Trofimovich
2019-12-28 13:49 Sergei Trofimovich
2019-12-25 10:58 Benda XU
2019-12-24 13:58 Mikle Kolyada
2019-12-15 10:59 Agostino Sarubbo
2019-12-13  7:36 Agostino Sarubbo
2019-12-12 21:52 Sergei Trofimovich
2019-12-12 16:00 Agostino Sarubbo
2019-12-12 13:52 Agostino Sarubbo
2019-12-12 10:59 Agostino Sarubbo
2019-12-11 13:21 Aaron Bauman
2019-12-10 19:03 Mikle Kolyada
2019-12-10 15:52 Mike Gilbert
2019-12-02 23:17 Sergei Trofimovich
2019-11-27 22:51 Andreas K. Hüttel
2019-11-26 23:45 Andreas K. Hüttel
2019-11-26 23:22 Andreas K. Hüttel
2019-11-25 23:49 Andreas K. Hüttel
2019-11-25  1:37 Andreas K. Hüttel
2019-11-21  7:54 Sergei Trofimovich
2019-11-17 10:42 Sergei Trofimovich
2019-11-16 21:42 Sergei Trofimovich
2019-11-16 21:25 Sergei Trofimovich
2019-11-10 22:41 Sergei Trofimovich
2019-11-10 22:41 Sergei Trofimovich
2019-11-10 22:41 Sergei Trofimovich
2019-11-10 22:41 Sergei Trofimovich
2019-11-10 22:41 Sergei Trofimovich
2019-11-08 20:43 Sergei Trofimovich
2019-11-06 20:10 Sergei Trofimovich
2019-10-22 18:07 Sergei Trofimovich
2019-10-19  9:37 Sergei Trofimovich
2019-10-19  9:37 Sergei Trofimovich
2019-10-19  9:37 Sergei Trofimovich
2019-10-19  9:37 Sergei Trofimovich
2019-10-18  6:47 Sergei Trofimovich
2019-10-17 23:22 Sergei Trofimovich
2019-10-14  6:58 Sergei Trofimovich
2019-10-12 20:03 Sergei Trofimovich
2019-09-25  8:04 Sergei Trofimovich
2019-09-01 21:59 Matt Turner
2019-09-01 16:50 Sergei Trofimovich
2019-08-28 18:28 Sergei Trofimovich
2019-08-27  1:14 Benda XU
2019-08-21 22:35 Sergei Trofimovich
2019-08-14 21:27 Andreas K. Hüttel
2019-08-13 21:36 Andreas K. Hüttel
2019-08-13 20:10 Andreas K. Hüttel
2019-08-12 21:35 Andreas K. Hüttel
2019-08-09 20:07 Andreas K. Hüttel
2019-08-06  0:59 Andreas K. Hüttel
2019-08-05 12:30 Andreas K. Hüttel
2019-08-04 12:13 Andreas K. Hüttel
2019-08-04  0:12 Andreas K. Hüttel
2019-08-03 22:45 Andreas K. Hüttel
2019-08-03 22:40 Andreas K. Hüttel
2019-07-29  9:05 Mikle Kolyada
2019-07-29  9:05 Mikle Kolyada
2019-07-29  9:05 Mikle Kolyada
2019-07-25 22:32 Sergei Trofimovich
2019-07-23  7:14 Sergei Trofimovich
2019-07-21 13:40 James Le Cuirot
2019-07-18  4:08 Benda XU
2019-06-23 14:50 Tobias Klausmann
2019-05-31  8:08 Agostino Sarubbo
2019-05-27 10:09 Agostino Sarubbo
2019-05-27 10:08 Agostino Sarubbo
2019-05-23 13:13 Mikle Kolyada
2019-05-19  9:37 Sergei Trofimovich
2019-05-19  9:15 Sergei Trofimovich
2019-05-19  8:39 Sergei Trofimovich
2019-05-16 23:56 Thomas Deutschmann
2019-05-13 19:14 Aaron Bauman
2019-05-13 12:08 Mikle Kolyada
2019-05-03 21:49 Andreas K. Hüttel
2019-05-02 15:31 Matt Turner
2019-05-01 18:46 Andreas K. Hüttel
2019-05-01  6:22 Matt Turner
2019-05-01  6:22 Matt Turner
2019-04-27 20:50 Sergei Trofimovich
2019-04-23 22:05 Andreas K. Hüttel
2019-04-21 19:06 Andreas K. Hüttel
2019-04-19  7:35 Sergei Trofimovich
2019-04-19  0:01 Andreas K. Hüttel
2019-04-18 23:45 Andreas K. Hüttel
2019-04-14 14:39 Andreas K. Hüttel
2019-04-13 22:13 Andreas K. Hüttel
2019-04-13 16:14 Andreas K. Hüttel
2019-04-10 14:45 Aaron Bauman
2019-04-08 16:07 Andreas K. Hüttel
2019-04-08 16:03 Andreas K. Hüttel
2019-04-08  6:05 Matt Turner
2019-04-08  2:18 Thomas Deutschmann
2019-04-07 16:40 Andreas K. Hüttel
2019-04-02 12:08 Mikle Kolyada
2019-04-02 12:08 Mikle Kolyada
2019-03-30 14:29 Andreas K. Hüttel
2019-03-26 21:08 Andreas K. Hüttel
2019-03-25 21:16 Sergei Trofimovich
2019-03-24 21:06 Andreas K. Hüttel
2019-03-24 17:00 Mikle Kolyada
2019-03-16 14:01 Mikle Kolyada
2019-03-15 10:01 Mikle Kolyada
2019-03-14 19:41 Sergei Trofimovich
2019-03-12  8:45 Sergei Trofimovich
2019-03-09 10:47 Sergei Trofimovich
2019-03-09 10:47 Sergei Trofimovich
2019-02-10 23:47 Sergei Trofimovich
2019-02-07 23:02 Sergei Trofimovich
2019-02-01 10:55 Andreas K. Hüttel
2019-01-14  0:00 Andreas K. Hüttel
2019-01-10 21:18 Andreas K. Hüttel
2019-01-08 23:40 Andreas K. Hüttel
2018-12-30 21:14 Sergei Trofimovich
2018-12-29 22:13 Andreas K. Hüttel
2018-12-21 23:55 Andreas K. Hüttel
2018-12-21 23:55 Andreas K. Hüttel
2018-12-21 16:21 Andreas K. Hüttel
2018-12-21 15:37 Andreas K. Hüttel
2018-12-15 12:28 Andreas K. Hüttel
2018-12-14 21:51 Andreas K. Hüttel
2018-12-14 21:23 Andreas K. Hüttel
2018-12-14 19:10 Andreas K. Hüttel
2018-12-11 22:58 Andreas K. Hüttel
2018-12-09 14:19 Andreas K. Hüttel
2018-12-08 23:45 Matt Turner
2018-12-08 23:45 Matt Turner
2018-12-08 15:10 Mikle Kolyada
2018-11-24 16:00 Mart Raudsepp
2018-11-23 23:51 Andreas K. Hüttel
2018-11-23 23:51 Andreas K. Hüttel
2018-11-09 18:15 Mikle Kolyada
2018-11-02 16:30 Jeroen Roovers
2018-11-02  7:50 Matt Turner
2018-10-27 18:43 Sergei Trofimovich
2018-10-26 22:09 Sergei Trofimovich
2018-10-26 21:21 Andreas Hüttel
2018-10-26 21:21 Andreas Hüttel
2018-10-24 21:41 Sergei Trofimovich
2018-10-21 17:47 Andreas Hüttel
2018-10-21 17:47 Andreas Hüttel
2018-10-21  7:49 Mikle Kolyada
2018-10-21  7:47 Mikle Kolyada
2018-09-11 15:43 Andreas Hüttel
2018-09-11 14:44 Andreas Hüttel
2018-09-11 14:44 Andreas Hüttel
2018-09-05 19:31 Anthony G. Basile
2018-09-05 15:36 Anthony G. Basile
2018-08-24 15:24 Jeroen Roovers
2018-08-06  7:22 Andreas Hüttel
2018-08-05  9:31 Andreas Hüttel
2018-08-03 21:21 Andreas Hüttel
2018-08-03 21:21 Andreas Hüttel
2018-08-03 20:21 Andreas Hüttel
2018-08-03 17:04 Andreas Hüttel
2018-07-19  0:38 Sergei Trofimovich
2018-07-07 18:20 Sergei Trofimovich
2018-07-02 18:27 Markus Meier
2018-06-26  9:48 Sergei Trofimovich
2018-06-26  9:48 Sergei Trofimovich
2018-06-25 16:06 Tobias Klausmann
2018-06-23  8:24 Sergei Trofimovich
2018-06-20 21:58 Andreas Hüttel
2018-06-17 17:27 Andreas Hüttel
2018-06-17 17:27 Andreas Hüttel
2018-06-17 17:22 Andreas Hüttel
2018-06-16 18:01 Andreas Hüttel
2018-06-15  7:02 Sergei Trofimovich
2018-06-13 22:01 Andreas Hüttel
2018-06-13 20:46 Sergei Trofimovich
2018-06-08 20:54 Sergei Trofimovich
2018-06-06 15:25 Thomas Deutschmann
2018-06-05 17:51 Mike Frysinger
2018-06-05 17:25 Mart Raudsepp
2018-06-04 23:40 Andreas Hüttel
2018-06-04 23:40 Andreas Hüttel
2018-06-04 23:40 Andreas Hüttel
2018-06-02 21:48 Sergei Trofimovich
2018-06-02 19:28 Andreas Hüttel
2018-05-22 14:35 Mike Frysinger
2018-05-20 23:47 Andreas Hüttel
2018-05-20 16:06 Andreas Hüttel
2018-05-19 23:38 Andreas Hüttel
2018-05-11 19:54 Andreas Hüttel
2018-05-06 20:49 Andreas Hüttel
2018-05-05 18:24 Andreas Hüttel
2018-05-05 18:18 Andreas Hüttel
2018-05-01 20:19 Andreas Hüttel
2018-04-28 21:23 Andreas Hüttel
2018-04-21 21:51 Andreas Hüttel
2018-04-21 21:25 Andreas Hüttel
2018-04-21  9:52 Mikle Kolyada
2018-04-13 23:22 Aaron Bauman
2018-04-13 20:08 Sergei Trofimovich
2018-04-09 22:38 Sergei Trofimovich
2018-04-09  6:23 Sergei Trofimovich
2018-04-08 10:55 Markus Meier
2018-04-06 19:13 Sergei Trofimovich
2018-04-06 19:13 Sergei Trofimovich
2018-04-06  6:43 Sergei Trofimovich
2018-04-03 20:21 Sergei Trofimovich
2018-04-03 20:21 Sergei Trofimovich
2018-04-01 21:47 Sergei Trofimovich
2018-03-31 14:17 Tobias Klausmann
2018-03-31 10:05 Sergei Trofimovich
2018-03-30 22:37 Sergei Trofimovich
2018-03-30 11:43 Sergei Trofimovich
2018-03-30 11:43 Sergei Trofimovich
2018-03-29 22:32 Mart Raudsepp
2018-03-29 19:39 Sergei Trofimovich
2018-03-29 15:19 Thomas Deutschmann
2018-03-29  0:39 Aaron Bauman
2018-03-22 22:23 Sergei Trofimovich
2018-03-15 13:59 Mikle Kolyada
2018-03-11  9:51 Sergei Trofimovich
2018-03-05 10:37 Tobias Klausmann
2018-03-04 21:54 Andreas Hüttel
2018-03-04 21:40 Andreas Hüttel
2018-03-03 17:56 Sergei Trofimovich
2018-03-02  9:38 Mart Raudsepp
2018-02-14 21:51 Andreas Hüttel
2018-02-10 19:57 Sergei Trofimovich
2018-02-10 19:16 Sergei Trofimovich
2018-02-10 15:39 Andreas Hüttel
2018-02-10  9:25 Sergei Trofimovich
2018-02-10  0:32 Thomas Deutschmann
2018-02-09 21:59 Andreas Hüttel
2018-02-09  9:01 Agostino Sarubbo
2018-02-08 23:50 Andreas Hüttel
2018-02-08 21:48 Andreas Hüttel
2018-02-06 21:37 Sergei Trofimovich
2018-02-03  1:38 Sergei Trofimovich
2018-02-03  1:38 Sergei Trofimovich
2018-02-03  1:38 Sergei Trofimovich
2018-02-03  1:18 Sergei Trofimovich
2018-02-03  0:49 Andreas Hüttel
2018-02-02 14:56 Andreas Hüttel
2018-02-02 14:34 Andreas Hüttel
2018-01-21 21:21 Andreas Hüttel
2018-01-21 10:38 Sergei Trofimovich
2018-01-20 19:26 Andreas Hüttel
2018-01-20 19:14 Andreas Hüttel
2018-01-20 18:13 Andreas Hüttel
2018-01-20 18:13 Andreas Hüttel
2018-01-20 17:36 Andreas Hüttel
2018-01-20 17:16 Andreas Hüttel
2018-01-20 16:57 Andreas Hüttel
2018-01-20  0:51 Andreas Hüttel
2018-01-17 23:09 Andreas Hüttel
2018-01-17  1:04 Andreas Hüttel
2018-01-14 19:17 Andreas Hüttel
2018-01-14 12:36 Andreas Hüttel
2018-01-13 21:25 Andreas Hüttel
2018-01-13 17:14 Andreas Hüttel
2018-01-10  8:09 Mike Frysinger
2018-01-07 19:39 Sergei Trofimovich
2018-01-03 10:47 Andreas Hüttel
2018-01-01 15:10 Andreas Hüttel
2017-12-31 21:26 Sergei Trofimovich
2017-12-24  9:46 Mart Raudsepp
2017-12-21 21:02 Andreas Hüttel
2017-12-20 12:37 Sergei Trofimovich
2017-12-17 22:27 Andreas Hüttel
2017-12-16 19:04 Andreas Hüttel
2017-12-15 21:57 Andreas Hüttel
2017-12-02 16:36 Andreas Hüttel
2017-11-29  5:56 Markus Meier
2017-11-18 20:50 Sergei Trofimovich
2017-11-18 18:34 Andreas Hüttel
2017-11-18 18:34 Andreas Hüttel
2017-11-14  9:36 Sergei Trofimovich
2017-11-14  9:00 Sergei Trofimovich
2017-11-13 23:26 Sergei Trofimovich
2017-11-13 17:11 Manuel Rüger
2017-11-12 14:16 Andreas Hüttel
2017-11-12 14:16 Andreas Hüttel
2017-11-12  1:10 Andreas Hüttel
2017-11-11 23:34 Sergei Trofimovich
2017-11-11 23:23 Matt Turner
2017-11-11 21:23 Andreas Hüttel
2017-11-11 18:00 Thomas Deutschmann
2017-11-11 17:50 Andreas Hüttel
2017-10-30 17:50 Andreas Hüttel
2017-10-29 11:13 Manuel Rüger
2017-10-28 19:47 Sergei Trofimovich
2017-10-27 23:30 Andreas Hüttel
2017-10-27 22:31 Andreas Hüttel
2017-10-26 18:51 Matt Turner
2017-10-25 22:03 Sergei Trofimovich
2017-10-24 21:15 Sergei Trofimovich
2017-10-24  6:24 Sergei Trofimovich
2017-10-23 21:39 Thomas Deutschmann
2017-10-22 19:46 Andreas Hüttel
2017-10-22 12:25 Andreas Hüttel
2017-10-21 12:47 Andreas Hüttel
2017-10-14 21:11 Andreas Hüttel
2017-10-07 22:26 Andreas Hüttel
2017-10-05 16:43 Andreas Hüttel
2017-10-05  9:11 Andreas Hüttel
2017-10-03 19:41 Andreas Hüttel
2017-10-03 16:19 Andreas Hüttel
2017-09-23 13:05 Andreas Hüttel
2017-09-18  9:54 Andreas Hüttel
2017-09-18  9:54 Andreas Hüttel
2017-09-17  7:51 Andreas Hüttel
2017-09-16 18:28 Andreas Hüttel
2017-09-16 15:48 Andreas Hüttel
2017-09-14 18:59 Andreas Hüttel
2017-09-12 19:46 Andreas Hüttel
2017-09-12 11:52 Andreas Hüttel
2017-09-11 18:32 Andreas Hüttel
2017-09-11 18:32 Andreas Hüttel
2017-09-11 12:16 Andreas Hüttel
2017-09-11 12:13 Andreas Hüttel
2017-09-11 10:20 Andreas Hüttel
2017-09-10 16:45 Andreas Hüttel
2017-09-10 10:08 Andreas Hüttel
2017-09-10  8:19 Andreas Hüttel
2017-09-09 21:43 Andreas Hüttel
2017-09-09 21:23 Andreas Hüttel
2017-09-09 21:23 Andreas Hüttel
2017-09-02 18:29 Alexis Ballier
2017-08-23 16:10 Andreas Hüttel
2017-08-17 21:13 Sergei Trofimovich
2017-08-13 16:08 Sergei Trofimovich
2017-08-12 16:59 Sergei Trofimovich
2017-08-08 13:53 Matthias Maier
2017-08-08 11:26 Sergei Trofimovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox